Fix missing parent assignment in rjp_add_member
This commit is contained in:
parent
45ed17d6ca
commit
b447a745a3
14
src/rjp.c
14
src/rjp.c
@ -42,6 +42,7 @@ RJP_value* rjp_add_member(RJP_value* dest, const char* key, RJP_index keylen, RJ
|
|||||||
mem.name.value[keylen] = 0;
|
mem.name.value[keylen] = 0;
|
||||||
mem.name.length = keylen;
|
mem.name.length = keylen;
|
||||||
mem.value = value;
|
mem.value = value;
|
||||||
|
mem.value.parent = dest;
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
RJP_value* retval;
|
RJP_value* retval;
|
||||||
@ -55,6 +56,7 @@ RJP_value* rjp_add_member_no_alloc(RJP_value* dest, char* key, RJP_index keylen,
|
|||||||
mem.name.value = key;
|
mem.name.value = key;
|
||||||
mem.name.length = keylen;
|
mem.name.length = keylen;
|
||||||
mem.value = value;
|
mem.value = value;
|
||||||
|
mem.value.parent = dest;
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
RJP_value* retval;
|
RJP_value* retval;
|
||||||
@ -70,12 +72,6 @@ RJP_value* rjp_remove_member(RJP_value* obj, RJP_value* member){
|
|||||||
return &(obj->object.root = irjp_tree_remove_value(obj->object.root, ((RJP_object_member*)member)->name.value, &status))->data.value;
|
return &(obj->object.root = irjp_tree_remove_value(obj->object.root, ((RJP_object_member*)member)->name.value, &status))->data.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
RJP_value* rjp_add_element(RJP_value* dest, RJP_value value){
|
|
||||||
irjp_add_element(&dest->array);
|
|
||||||
dest->array.last->value = value;
|
|
||||||
dest->array.last->value.parent = dest;
|
|
||||||
return &dest->array.last->value;
|
|
||||||
}
|
|
||||||
void rjp_set_key(RJP_value* dest, const char* key, RJP_index keylen){
|
void rjp_set_key(RJP_value* dest, const char* key, RJP_index keylen){
|
||||||
RJP_object_member* mem = (RJP_object_member*)dest;
|
RJP_object_member* mem = (RJP_object_member*)dest;
|
||||||
if(key){
|
if(key){
|
||||||
@ -198,6 +194,12 @@ RJP_index rjp_search_members(const RJP_value* object, RJP_index num, const char*
|
|||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RJP_value* rjp_add_element(RJP_value* dest, RJP_value value){
|
||||||
|
irjp_add_element(&dest->array);
|
||||||
|
dest->array.last->value = value;
|
||||||
|
dest->array.last->value.parent = dest;
|
||||||
|
return &dest->array.last->value;
|
||||||
|
}
|
||||||
RJP_value* rjp_get_element(const RJP_value* array){
|
RJP_value* rjp_get_element(const RJP_value* array){
|
||||||
return &array->array.elements->value;
|
return &array->array.elements->value;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user