From 512c313111194e446ff22067bea47e9483e97999 Mon Sep 17 00:00:00 2001 From: Max Bruckner Date: Sun, 30 Apr 2017 13:13:17 +0200 Subject: [PATCH] refactor cJSONUtils_AddPatchToArray --- cJSON_Utils.c | 4 ++-- cJSON_Utils.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cJSON_Utils.c b/cJSON_Utils.c index a706163..a96045c 100644 --- a/cJSON_Utils.c +++ b/cJSON_Utils.c @@ -876,9 +876,9 @@ static void cJSONUtils_GeneratePatch(cJSON * const patches, const unsigned char cJSON_AddItemToArray(patches, patch); } -CJSON_PUBLIC(void) cJSONUtils_AddPatchToArray(cJSON *array, const char *op, const char *path, cJSON *val) +CJSON_PUBLIC(void) cJSONUtils_AddPatchToArray(cJSON * const array, const char * const operation, const char * const path, const cJSON * const value) { - cJSONUtils_GeneratePatch(array, (const unsigned char*)op, (const unsigned char*)path, 0, val); + cJSONUtils_GeneratePatch(array, (const unsigned char*)operation, (const unsigned char*)path, NULL, value); } static void cJSONUtils_CompareToPatch(cJSON *patches, const unsigned char *path, cJSON *from, cJSON *to) diff --git a/cJSON_Utils.h b/cJSON_Utils.h index 572ab93..0d90cd6 100644 --- a/cJSON_Utils.h +++ b/cJSON_Utils.h @@ -28,7 +28,7 @@ CJSON_PUBLIC(cJSON *) cJSONUtils_GetPointer(cJSON * const object, const char *po /* Implement RFC6902 (https://tools.ietf.org/html/rfc6902) JSON Patch spec. */ CJSON_PUBLIC(cJSON *) cJSONUtils_GeneratePatches(cJSON *from, cJSON *to); /* Utility for generating patch array entries. */ -CJSON_PUBLIC(void) cJSONUtils_AddPatchToArray(cJSON *array, const char *op, const char *path, cJSON *val); +CJSON_PUBLIC(void) cJSONUtils_AddPatchToArray(cJSON * const array, const char * const operation, const char * const path, const cJSON * const value); /* Returns 0 for success. */ CJSON_PUBLIC(int) cJSONUtils_ApplyPatches(cJSON * const object, const cJSON * const patches);