Clean up many strdups

This commit is contained in:
2022-11-02 20:36:07 -04:00
parent 9c1a81811c
commit 3b7bef779b
11 changed files with 39 additions and 31 deletions

View File

@@ -3,7 +3,7 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
static struct ucl_object *ucl_object_alloc();
@@ -28,7 +28,7 @@ struct ucl_object *ucl_symbol_create(const char *symbol)
{
struct ucl_object* obj = ucl_object_alloc();
obj->type = UCL_TYPE_SYMBOL;
obj->symbol = symbol;
obj->symbol = strdup(symbol);
return obj;
}
@@ -36,7 +36,7 @@ struct ucl_object *ucl_string_create(const char *string)
{
struct ucl_object* obj = ucl_object_alloc();
obj->type = UCL_TYPE_STRING;
obj->string = string;
obj->string = strdup(string);
return obj;
}
@@ -44,7 +44,7 @@ struct ucl_object *ucl_error_create(const char *error)
{
struct ucl_object* obj = ucl_object_alloc();
obj->type = UCL_TYPE_ERROR;
obj->error = error;
obj->error = strdup(error);
return obj;
}