}
void*
-array_list_get(struct array_list *arr, size_t i)
+array_list_get_idx(struct array_list *arr, size_t i)
{
if(i >= arr->length) return NULL;
return arr->array[i];
}
int
-array_list_insert(struct array_list *arr, size_t idx, void *data)
+array_list_put_idx(struct array_list *arr, size_t idx, void *data)
{
if (idx > SIZE_T_MAX - 1 ) return -1;
if(array_list_expand_internal(arr, idx+1)) return -1;
int
array_list_add(struct array_list *arr, void *data)
{
- return array_list_insert(arr, arr->length, data);
+ return array_list_put_idx(arr, arr->length, data);
}
void
array_list_free(struct array_list *al);
extern void*
-array_list_get(struct array_list *al, size_t i);
+array_list_get_idx(struct array_list *al, size_t i);
extern int
-array_list_insert(struct array_list *al, size_t i, void *data);
+array_list_put_idx(struct array_list *al, size_t i, void *data);
extern int
array_list_add(struct array_list *al, void *data);
/* reference counting */
-extern struct json_object* json_object_retain(struct json_object *jso)
+extern struct json_object* json_object_get(struct json_object *jso)
{
if (!jso) return jso;
return jso;
}
-int json_object_release(struct json_object *jso)
+int json_object_put(struct json_object *jso)
{
if(!jso) return 0;
{
if (!ent->k_is_constant)
free(lh_entry_k(ent));
- json_object_release((struct json_object*)lh_entry_v(ent));
+ json_object_put((struct json_object*)lh_entry_v(ent));
}
static void json_object_object_delete(struct json_object* jso)
}
existing_value = (json_object *) lh_entry_v(existing_entry);
if (existing_value)
- json_object_release(existing_value);
+ json_object_put(existing_value);
existing_entry->v = val;
return 0;
}
static void json_object_array_entry_free(void *data)
{
- json_object_release((struct json_object*)data);
+ json_object_put((struct json_object*)data);
}
static void json_object_array_delete(struct json_object* jso)
struct json_object *val)
{
assert(json_object_get_type(jso) == json_type_array);
- return array_list_insert(jso->o.c_array, idx, val);
+ return array_list_put_idx(jso->o.c_array, idx, val);
}
int json_object_array_del_idx(struct json_object *jso, size_t idx, size_t count)
size_t idx)
{
assert(json_object_get_type(jso) == json_type_array);
- return (struct json_object*)array_list_get(jso->o.c_array, idx);
+ return (struct json_object*)array_list_get_idx(jso->o.c_array, idx);
}
static int json_array_equal(struct json_object* jso1,
*
* @param obj the json_object instance
*/
-JSON_EXPORT struct json_object* json_object_retain(struct json_object *obj);
+JSON_EXPORT struct json_object* json_object_get(struct json_object *obj);
/**
* Decrement the reference count of json_object and free if it reaches zero.
* @param obj the json_object instance
* @returns 1 if the object was freed.
*/
-JSON_EXPORT int json_object_release(struct json_object *obj);
+JSON_EXPORT int json_object_put(struct json_object *obj);
/**
* Check if the json_object is of a given type
}
if (path[0] == '\0') {
- json_object_release(*obj);
+ json_object_put(*obj);
*obj = value;
return 0;
}
return rc;
if (path_copy[0] == '\0') {
- json_object_release(*obj);
+ json_object_put(*obj);
*obj = value;
goto out;
}
{
tok->stack[depth].state = json_tokener_state_eatws;
tok->stack[depth].saved_state = json_tokener_state_start;
- json_object_release(tok->stack[depth].current);
+ json_object_put(tok->stack[depth].current);
tok->stack[depth].current = NULL;
free(tok->stack[depth].obj_field_name);
tok->stack[depth].obj_field_name = NULL;
*error = tok->err;
if(tok->err != json_tokener_success) {
if (obj != NULL)
- json_object_release(obj);
+ json_object_put(obj);
obj = NULL;
}
case json_tokener_state_finish:
if(tok->depth == 0) goto out;
- obj = json_object_retain(current);
+ obj = json_object_get(current);
json_tokener_reset_level(tok, tok->depth);
tok->depth--;
goto redo_char;
if (tok->err == json_tokener_success)
{
- json_object *ret = json_object_retain(current);
+ json_object *ret = json_object_get(current);
int ii;
/* Partially reset, so we parse additional objects on subsequent calls. */