mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-08 10:08:06 +02:00
[script] Creating a string object with a NULL string now returns a NULL object
Strings in C are often set to NULL to signify that they have not been set. This should be carried through to the script system rather than failing at the conversion.
This commit is contained in:
parent
5df19c2b1b
commit
e7fad23f70
1 changed files with 8 additions and 8 deletions
|
|
@ -192,6 +192,13 @@ char* script_obj_print (script_obj* obj)
|
|||
}
|
||||
|
||||
|
||||
script_obj* script_obj_new_null (void)
|
||||
{
|
||||
script_obj* obj = malloc(sizeof(script_obj));
|
||||
obj->type = SCRIPT_OBJ_TYPE_NULL;
|
||||
obj->refcount = 1;
|
||||
return obj;
|
||||
}
|
||||
|
||||
script_obj* script_obj_new_int (int number)
|
||||
{
|
||||
|
|
@ -213,6 +220,7 @@ script_obj* script_obj_new_float (float number)
|
|||
|
||||
script_obj* script_obj_new_string (const char* string)
|
||||
{
|
||||
if (!string) return script_obj_new_null ();
|
||||
script_obj* obj = malloc(sizeof(script_obj));
|
||||
obj->type = SCRIPT_OBJ_TYPE_STRING;
|
||||
obj->refcount = 1;
|
||||
|
|
@ -220,14 +228,6 @@ script_obj* script_obj_new_string (const char* string)
|
|||
return obj;
|
||||
}
|
||||
|
||||
script_obj* script_obj_new_null (void)
|
||||
{
|
||||
script_obj* obj = malloc(sizeof(script_obj));
|
||||
obj->type = SCRIPT_OBJ_TYPE_NULL;
|
||||
obj->refcount = 1;
|
||||
return obj;
|
||||
}
|
||||
|
||||
script_obj* script_obj_new_hash (void)
|
||||
{
|
||||
script_obj* obj = malloc(sizeof(script_obj));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue