提交 aefe2f85 编写于 作者: M Max Bruckner

cJSONUtils_PatchDetach -> detach_path

上级 7f645de3
...@@ -356,7 +356,8 @@ static cJSON *detach_item_from_array(cJSON *array, size_t which) ...@@ -356,7 +356,8 @@ static cJSON *detach_item_from_array(cJSON *array, size_t which)
return c; return c;
} }
static cJSON *cJSONUtils_PatchDetach(cJSON *object, const unsigned char *path) /* detach an item at the given path */
static cJSON *detach_path(cJSON *object, const unsigned char *path)
{ {
unsigned char *parent_pointer = NULL; unsigned char *parent_pointer = NULL;
unsigned char *child_pointer = NULL; unsigned char *child_pointer = NULL;
...@@ -685,7 +686,7 @@ static int cJSONUtils_ApplyPatch(cJSON *object, const cJSON *patch) ...@@ -685,7 +686,7 @@ static int cJSONUtils_ApplyPatch(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 = cJSONUtils_PatchDetach(object, (unsigned char*)path->valuestring); cJSON *old_item = detach_path(object, (unsigned char*)path->valuestring);
if (old_item == NULL) if (old_item == NULL)
{ {
status = 13; status = 13;
...@@ -713,7 +714,7 @@ static int cJSONUtils_ApplyPatch(cJSON *object, const cJSON *patch) ...@@ -713,7 +714,7 @@ static int cJSONUtils_ApplyPatch(cJSON *object, const cJSON *patch)
if (opcode == MOVE) if (opcode == MOVE)
{ {
value = cJSONUtils_PatchDetach(object, (unsigned char*)from->valuestring); value = detach_path(object, (unsigned char*)from->valuestring);
} }
if (opcode == COPY) if (opcode == COPY)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册