in parson.c [498:519]
static JSON_Status json_object_remove_internal(_Ptr<JSON_Object> object, _Nt_array_ptr<const char> name, int free_value) {
size_t i = 0, last_item_index = 0;
if (object == NULL || json_object_get_value(object, name) == NULL) {
return JSONFailure;
}
last_item_index = json_object_get_count(object) - 1;
for (i = 0; i < json_object_get_count(object); i++) {
if (strcmp(object->names[i], name) == 0) {
parson_free(char, object->names[i]);
if (free_value) {
json_value_free(object->values[i]);
}
if (i != last_item_index) { /* Replace key value pair with one from the end */
object->names[i] = object->names[last_item_index];
object->values[i] = object->values[last_item_index];
}
object->count -= 1;
return JSONSuccess;
}
}
return JSONFailure; /* No execution path should end here */
}