typedef struct {
json_t json;
- hashtable_t *hashtable;
+ hashtable_t hashtable;
} json_object_t;
typedef struct {
return NULL;
json_init(&object->json, JSON_OBJECT);
- object->hashtable =
- hashtable_new(hash_string, string_equal, free, value_decref);
- if(!object->hashtable)
+ if(hashtable_init(&object->hashtable, hash_string, string_equal,
+ free, value_decref))
{
free(object);
return NULL;
static void json_delete_object(json_object_t *object)
{
- hashtable_free(object->hashtable);
+ hashtable_close(&object->hashtable);
free(object);
}
if(!json_is_object(json))
return NULL;
- return hashtable_get(object->hashtable, key);
+ return hashtable_get(&object->hashtable, key);
}
int json_object_set(json_t *json, const char *key, json_t *value)
return -1;
object = json_to_object(json);
- return hashtable_set(object->hashtable, strdup(key), json_incref(value));
+ return hashtable_set(&object->hashtable, strdup(key), json_incref(value));
}
int json_object_del(json_t *json, const char *key)
return -1;
object = json_to_object(json);
- return hashtable_del(object->hashtable, key);
+ return hashtable_del(&object->hashtable, key);
}
void *json_object_iter(json_t *json)
return NULL;
object = json_to_object(json);
- return hashtable_iter(object->hashtable);
+ return hashtable_iter(&object->hashtable);
}
void *json_object_iter_next(json_t *json, void *iter)
return NULL;
object = json_to_object(json);
- return hashtable_iter_next(object->hashtable, iter);
+ return hashtable_iter_next(&object->hashtable, iter);
}
const char *json_object_iter_key(void *iter)