mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
JUst use strdup instead of strcpy_alloc
This commit is contained in:
parent
bb3e7fad66
commit
0421d463f8
46
retroarch.c
46
retroarch.c
@ -10709,30 +10709,12 @@ static void free_retro_ctx_load_content_info(struct
|
||||
static struct retro_game_info* clone_retro_game_info(const
|
||||
struct retro_game_info *src)
|
||||
{
|
||||
struct retro_game_info *dest = NULL;
|
||||
|
||||
if (!src)
|
||||
return NULL;
|
||||
|
||||
dest = (struct retro_game_info*)calloc(1,
|
||||
struct retro_game_info *dest = (struct retro_game_info*)calloc(1,
|
||||
sizeof(struct retro_game_info));
|
||||
|
||||
if (!dest)
|
||||
return NULL;
|
||||
|
||||
dest->data = NULL;
|
||||
|
||||
if (src->path)
|
||||
{
|
||||
size_t len = strlen(src->path);
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
char *result = (char*)malloc(len+1);
|
||||
strcpy(result, src->path);
|
||||
dest->path = result;
|
||||
}
|
||||
}
|
||||
|
||||
if (src->size && src->data)
|
||||
{
|
||||
void *data = malloc(src->size);
|
||||
@ -10744,20 +10726,13 @@ static struct retro_game_info* clone_retro_game_info(const
|
||||
}
|
||||
}
|
||||
|
||||
if (!string_is_empty(src->path))
|
||||
dest->path = strdup(src->path);
|
||||
if (!string_is_empty(src->meta))
|
||||
dest->meta = strdup(src->meta);
|
||||
|
||||
dest->size = src->size;
|
||||
|
||||
if (src->meta)
|
||||
{
|
||||
size_t len = strlen(src->meta);
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
char *result = (char*)malloc(len+1);
|
||||
strcpy(result, src->meta);
|
||||
dest->meta = result;
|
||||
}
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
@ -10776,12 +10751,11 @@ static struct retro_ctx_load_content_info
|
||||
if (!dest)
|
||||
return NULL;
|
||||
|
||||
dest->info = clone_retro_game_info(src->info);
|
||||
dest->content = NULL;
|
||||
dest->special = NULL;
|
||||
|
||||
if (src->info)
|
||||
dest->info = clone_retro_game_info(src->info);
|
||||
if (src->content)
|
||||
dest->content = string_list_clone(src->content);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user