mirror of
https://github.com/DaveGamble/cJSON.git
synced 2023-08-10 21:13:26 +03:00
detach_path: Configurable case sensitivity
This commit is contained in:
parent
af9c76e37e
commit
7de847eeea
@ -367,9 +367,8 @@ static cJSON *detach_item_from_array(cJSON *array, size_t which)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* detach an item at the given path */
|
/* detach an item at the given path */
|
||||||
static cJSON *detach_path(cJSON *object, const unsigned char *path)
|
static cJSON *detach_path(cJSON *object, const unsigned char *path, const cJSON_bool case_sensitive)
|
||||||
{
|
{
|
||||||
cJSON_bool case_sensitive = false;
|
|
||||||
unsigned char *parent_pointer = NULL;
|
unsigned char *parent_pointer = NULL;
|
||||||
unsigned char *child_pointer = NULL;
|
unsigned char *child_pointer = NULL;
|
||||||
cJSON *parent = NULL;
|
cJSON *parent = NULL;
|
||||||
@ -698,7 +697,7 @@ static int apply_patch(cJSON *object, const cJSON *patch)
|
|||||||
if ((opcode == REMOVE) || (opcode == REPLACE))
|
if ((opcode == REMOVE) || (opcode == REPLACE))
|
||||||
{
|
{
|
||||||
/* Get rid of old. */
|
/* Get rid of old. */
|
||||||
cJSON *old_item = detach_path(object, (unsigned char*)path->valuestring);
|
cJSON *old_item = detach_path(object, (unsigned char*)path->valuestring, case_sensitive);
|
||||||
if (old_item == NULL)
|
if (old_item == NULL)
|
||||||
{
|
{
|
||||||
status = 13;
|
status = 13;
|
||||||
@ -726,7 +725,7 @@ static int apply_patch(cJSON *object, const cJSON *patch)
|
|||||||
|
|
||||||
if (opcode == MOVE)
|
if (opcode == MOVE)
|
||||||
{
|
{
|
||||||
value = detach_path(object, (unsigned char*)from->valuestring);
|
value = detach_path(object, (unsigned char*)from->valuestring, case_sensitive);
|
||||||
}
|
}
|
||||||
if (opcode == COPY)
|
if (opcode == COPY)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user