Remove memcpy_alloc

This commit is contained in:
twinaphex 2018-04-08 01:41:41 +02:00
parent 4f32eb9cc1
commit 2ca52bd08c
3 changed files with 15 additions and 12 deletions

View File

@ -22,18 +22,29 @@ static void free_retro_game_info(struct retro_game_info *dest)
static struct retro_game_info* clone_retro_game_info(const
struct retro_game_info *src)
{
void *data = NULL;
struct retro_game_info *dest = NULL;
if (!src)
return NULL;
dest = (struct retro_game_info*)calloc(1,
sizeof(struct retro_game_info));
if (!dest)
return NULL;
dest->path = strcpy_alloc(src->path);
dest->data = memcpy_alloc(src->data, src->size);
dest->size = src->size;
dest->meta = strcpy_alloc(src->meta);
dest->data = NULL;
dest->path = strcpy_alloc(src->path);
data = malloc(src->size);
if (data)
{
memcpy(data, src->data, src->size);
dest->data = data;
}
dest->size = src->size;
dest->meta = strcpy_alloc(src->meta);
return dest;
}

View File

@ -2,13 +2,6 @@
#include "mem_util.h"
void *memcpy_alloc(const void *src, size_t size)
{
void *result = malloc(size);
memcpy(result, src, size);
return result;
}
char *strcpy_alloc(const char *sourceStr)
{
size_t len = 0;

View File

@ -14,7 +14,6 @@ RETRO_BEGIN_DECLS
char *strcpy_alloc(const char *sourceStr);
char *strcpy_alloc_force(const char *sourceStr);
void strcat_alloc(char ** destStr_p, const char *appendStr);
void *memcpy_alloc(const void *src, size_t size);
RETRO_END_DECLS