Get rid of free_str

This commit is contained in:
twinaphex 2018-03-29 18:29:25 +02:00
parent 2db0c21f52
commit 8703ad8374
3 changed files with 10 additions and 16 deletions

View File

@ -9,11 +9,6 @@ void *malloc_zero(size_t size)
return ptr; return ptr;
} }
void free_str(char **str_p)
{
free_ptr((void**)str_p);
}
void free_ptr(void **data_p) void free_ptr(void **data_p)
{ {
if (!data_p || !*data_p) if (!data_p || !*data_p)

View File

@ -12,7 +12,6 @@
RETRO_BEGIN_DECLS RETRO_BEGIN_DECLS
void *malloc_zero(size_t size); void *malloc_zero(size_t size);
void free_str(char **str_p);
void free_ptr(void **data_p); void free_ptr(void **data_p);
char *strcpy_alloc(const char *sourceStr); char *strcpy_alloc(const char *sourceStr);
char *strcpy_alloc_force(const char *sourceStr); char *strcpy_alloc_force(const char *sourceStr);

View File

@ -128,16 +128,16 @@ char* copy_core_to_temp_file(void)
goto failed; goto failed;
} }
free_str(&tempDirectory); free_ptr((void**)&tempDirectory);
free_str(&retroarchTempPath); free_ptr((void**)&retroarchTempPath);
free_ptr(&dllFileData); free_ptr(&dllFileData);
return tempDllPath; return tempDllPath;
failed: failed:
free_str(&tempDirectory); free_ptr((void**)&tempDirectory);
free_str(&retroarchTempPath); free_ptr((void**)&retroarchTempPath);
free_str(&tempDllPath); free_ptr((void**)&tempDllPath);
free_ptr(&dllFileData); free_ptr((void**)&dllFileData);
return NULL; return NULL;
} }
@ -168,7 +168,7 @@ bool write_file_with_random_name(char **tempDllPath,
numberValue = numberValue * 214013 + 2531011; numberValue = numberValue * 214013 + 2531011;
number = (numberValue >> 14) % 100000; number = (numberValue >> 14) % 100000;
sprintf(numberBuf, "%05d", number); sprintf(numberBuf, "%05d", number);
free_str(tempDllPath); free_ptr((void**)tempDllPath);
strcat_alloc(tempDllPath, retroarchTempPath); strcat_alloc(tempDllPath, retroarchTempPath);
strcat_alloc(tempDllPath, prefix); strcat_alloc(tempDllPath, prefix);
strcat_alloc(tempDllPath, numberBuf); strcat_alloc(tempDllPath, numberBuf);
@ -178,7 +178,7 @@ bool write_file_with_random_name(char **tempDllPath,
break; break;
} }
free_str(&ext); free_ptr((void**)&ext);
return true; return true;
} }
@ -199,7 +199,7 @@ bool secondary_core_create(void)
load_content_info->special) load_content_info->special)
return false; return false;
free_str(&secondary_library_path); free_ptr((void**)&secondary_library_path);
secondary_library_path = copy_core_to_temp_file(); secondary_library_path = copy_core_to_temp_file();
if (!secondary_library_path) if (!secondary_library_path)
@ -321,7 +321,7 @@ void secondary_core_destroy(void)
dylib_close(secondary_module); dylib_close(secondary_module);
secondary_module = NULL; secondary_module = NULL;
filestream_delete(secondary_library_path); filestream_delete(secondary_library_path);
free_str(&secondary_library_path); free_ptr((void**)&secondary_library_path);
} }
} }