Lines Matching refs:path

119 /* Compare the next path element of two JSON pointers, two NULL pointers are considered unequal: */
234 sprintf((char*)full_pointer, "/%lu%s", (unsigned long)child_index, target_pointer); /* /<array_index><path> */
310 /* follow path of the pointer */
338 /* skip to the next path token or end of string */
429 /* detach an item at the given path */
430 static cJSON *detach_path(cJSON *object, const unsigned char *path, const cJSON_bool case_sensitive)
437 /* copy path and split it in parent and child */
438 parent_pointer = cJSONUtils_strdup(path);
826 cJSON *path = NULL;
834 path = get_object_item(patch, "path", case_sensitive);
835 if (!cJSON_IsString(path))
850 /* compare value: {...} with the given path */
851 status = !compare_json(get_item_from_pointer(object, path->valuestring, case_sensitive), get_object_item(patch, "value", case_sensitive), case_sensitive);
856 if (path->valuestring[0] == '\0')
907 cJSON *old_item = detach_path(object, (unsigned char*)path->valuestring, case_sensitive);
976 /* Now, just add "value" to "path". */
979 parent_pointer = cJSONUtils_strdup((unsigned char*)path->valuestring);
1113 static void compose_patch(cJSON * const patches, const unsigned char * const operation, const unsigned char * const path, const unsigned char *suffix, const cJSON * const value)
1117 if ((patches == NULL) || (operation == NULL) || (path == NULL))
1131 cJSON_AddItemToObject(patch, "path", cJSON_CreateString((const char*)path));
1136 size_t path_length = strlen((const char*)path);
1139 sprintf((char*)full_path, "%s/", (const char*)path);
1142 cJSON_AddItemToObject(patch, "path", cJSON_CreateString((const char*)full_path));
1153 CJSON_PUBLIC(void) cJSONUtils_AddPatchToArray(cJSON * const array, const char * const operation, const char * const path, const cJSON * const value)
1155 compose_patch(array, (const unsigned char*)operation, (const unsigned char*)path, NULL, value);
1158 static void create_patches(cJSON * const patches, const unsigned char * const path, cJSON * const from, cJSON * const to, const cJSON_bool case_sensitive)
1167 compose_patch(patches, (const unsigned char*)"replace", path, 0, to);
1176 compose_patch(patches, (const unsigned char*)"replace", path, NULL, to);
1183 compose_patch(patches, (const unsigned char*)"replace", path, NULL, to);
1192 unsigned char *new_path = (unsigned char*)cJSON_malloc(strlen((const char*)path) + 20 + sizeof("/")); /* Allow space for 64bit int. log10(2^64) = 20 */
1205 sprintf((char*)new_path, "%s/%lu", path, (unsigned long)index); /* path of the current array element */
1221 compose_patch(patches, (const unsigned char*)"remove", path, new_path, NULL);
1226 compose_patch(patches, (const unsigned char*)"add", path, (const unsigned char*)"-", to_child);
1261 size_t path_length = strlen((const char*)path);
1265 sprintf((char*)new_path, "%s/", path);
1278 compose_patch(patches, (const unsigned char*)"remove", path, (unsigned char*)from_child->string, NULL);
1285 compose_patch(patches, (const unsigned char*)"add", path, (unsigned char*)to_child->string, to_child);