mirror of
https://github.com/json-c/json-c.git
synced 2026-03-29 09:59:06 +08:00
Kick json_type_string out of struct json_object.
The default is now that string data is stored inline at the end of json_object, though to allow for json_object_set_string() to set a _longer_ string, we still need to allow for the possibility of a separate char * pointer. All json types have been split out now, next step it cleanup.
This commit is contained in:
@@ -58,12 +58,16 @@ int main(int argc, char **argv)
|
||||
#define HUGE "A string longer than 32 chars as to check non local buf codepath"
|
||||
tmp = json_object_new_string(SHORT);
|
||||
assert(strcmp(json_object_get_string(tmp), SHORT) == 0);
|
||||
assert(strcmp(json_object_to_json_string(tmp), "\"" SHORT "\"") == 0);
|
||||
json_object_set_string(tmp, MID);
|
||||
assert(strcmp(json_object_get_string(tmp), MID) == 0);
|
||||
assert(strcmp(json_object_to_json_string(tmp), "\"" MID "\"") == 0);
|
||||
json_object_set_string(tmp, HUGE);
|
||||
assert(strcmp(json_object_get_string(tmp), HUGE) == 0);
|
||||
assert(strcmp(json_object_to_json_string(tmp), "\"" HUGE "\"") == 0);
|
||||
json_object_set_string(tmp, SHORT);
|
||||
assert(strcmp(json_object_get_string(tmp), SHORT) == 0);
|
||||
assert(strcmp(json_object_to_json_string(tmp), "\"" SHORT "\"") == 0);
|
||||
json_object_put(tmp);
|
||||
printf("STRING PASSED\n");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user