Lines Matching defs:obj
71 static const char* parse_value(const char *str, const char *end, pa_json_object **obj, unsigned int depth);
74 pa_json_object *obj;
76 obj = pa_xnew0(pa_json_object, 1);
78 return obj;
115 static const char* parse_null(const char *str, pa_json_object *obj) {
119 obj->type = PA_JSON_TYPE_NULL;
124 static const char* parse_boolean(const char *str, pa_json_object *obj) {
130 obj->type = PA_JSON_TYPE_BOOL;
131 obj->bool_value = true;
136 obj->type = PA_JSON_TYPE_BOOL;
137 obj->bool_value = false;
144 static const char* parse_string(const char *str, pa_json_object *obj) {
210 obj->type = PA_JSON_TYPE_STRING;
211 obj->string_value = pa_strbuf_to_string_free(buf);
220 static const char* parse_number(const char *str, pa_json_object *obj) {
287 if (pa_atod(candidate, &obj->double_value) < 0) {
291 obj->type = PA_JSON_TYPE_DOUBLE;
293 if (pa_atoi64(candidate, &obj->int_value) < 0) {
297 obj->type = PA_JSON_TYPE_INT;
309 static const char *parse_object(const char *str, pa_json_object *obj, unsigned int depth) {
312 obj->object_values = pa_hashmap_new_full(pa_idxset_string_hash_func, pa_idxset_string_compare_func,
333 pa_hashmap_put(obj->object_values, pa_xstrdup(pa_json_object_get_string(name)), value);
344 obj->type = PA_JSON_TYPE_OBJECT;
349 pa_hashmap_free(obj->object_values);
350 obj->object_values = NULL;
360 static const char *parse_array(const char *str, pa_json_object *obj, unsigned int depth) {
363 obj->array_values = pa_idxset_new(NULL, NULL);
382 pa_idxset_put(obj->array_values, value, NULL);
389 obj->type = PA_JSON_TYPE_ARRAY;
394 pa_idxset_free(obj->array_values, (pa_free_cb_t) pa_json_object_free);
395 obj->array_values = NULL;
404 static const char* parse_value(const char *str, const char *end, pa_json_object **obj, unsigned int depth) {
466 *obj = o;
477 pa_json_object *obj;
479 str = parse_value(str, NULL, &obj, 0);
488 pa_json_object_free(obj);
492 return obj;
495 pa_json_type pa_json_object_get_type(const pa_json_object *obj) {
496 return obj->type;
499 void pa_json_object_free(pa_json_object *obj) {
501 switch (pa_json_object_get_type(obj)) {
510 pa_xfree(obj->string_value);
514 pa_hashmap_free(obj->object_values);
518 pa_idxset_free(obj->array_values, (pa_free_cb_t) pa_json_object_free);
525 pa_xfree(obj);