Revert cJSON_AddItemReferenceToObjectCS to keep branch clean

This reverts commit 1208b35e03.
This commit is contained in:
No Default Name 2022-05-24 22:23:46 +02:00
parent 2ff0894010
commit c4429d580e
3 changed files with 0 additions and 14 deletions

10
cJSON.c
View File

@ -2132,16 +2132,6 @@ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const cha
return add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, false); return add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, false);
} }
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObjectCS(cJSON *object, const char *string, cJSON *item)
{
if ((object == NULL) || (string == NULL))
{
return false;
}
return add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, true);
}
CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name) CJSON_PUBLIC(cJSON*) cJSON_AddNullToObject(cJSON * const object, const char * const name)
{ {
cJSON *null = cJSON_CreateNull(); cJSON *null = cJSON_CreateNull();

View File

@ -258,7 +258,6 @@ CJSON_PUBLIC(cJSON_bool) cJSON_AddItemToObjectCS(cJSON *object, const char *stri
/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */ /* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item);
CJSON_PUBLIC(cJSON_bool) cJSON_AddItemReferenceToObjectCS(cJSON *object, const char *string, cJSON *item);
/* Remove/Detach items from Arrays/Objects. */ /* Remove/Detach items from Arrays/Objects. */
CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item); CJSON_PUBLIC(cJSON *) cJSON_DetachItemViaPointer(cJSON *parent, cJSON * const item);

View File

@ -411,9 +411,6 @@ static void cjson_functions_should_not_crash_with_null_pointers(void)
cJSON_AddItemReferenceToObject(item, "item", NULL); cJSON_AddItemReferenceToObject(item, "item", NULL);
cJSON_AddItemReferenceToObject(item, NULL, item); cJSON_AddItemReferenceToObject(item, NULL, item);
cJSON_AddItemReferenceToObject(NULL, "item", item); cJSON_AddItemReferenceToObject(NULL, "item", item);
cJSON_AddItemReferenceToObjectCS(item, "item", NULL);
cJSON_AddItemReferenceToObjectCS(item, NULL, item);
cJSON_AddItemReferenceToObjectCS(NULL, "item", item);
TEST_ASSERT_NULL(cJSON_DetachItemViaPointer(NULL, item)); TEST_ASSERT_NULL(cJSON_DetachItemViaPointer(NULL, item));
TEST_ASSERT_NULL(cJSON_DetachItemViaPointer(item, NULL)); TEST_ASSERT_NULL(cJSON_DetachItemViaPointer(item, NULL));
TEST_ASSERT_NULL(cJSON_DetachItemFromArray(NULL, 0)); TEST_ASSERT_NULL(cJSON_DetachItemFromArray(NULL, 0));