Skip to content

Commit

Permalink
Add json_object_value_name().
Browse files Browse the repository at this point in the history
  • Loading branch information
Barenboim committed Feb 10, 2025
1 parent cae71e4 commit 0c15ff4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/util/json_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1180,6 +1180,12 @@ const json_value_t *json_object_prev_value(const json_value_t *val,
return &list_entry(pos->prev, json_member_t, list)->value;
}

const char *json_object_value_name(const json_value_t *val,
const json_object_t *obj)
{
return list_entry(val, json_member_t, value)->name;
}

static const json_value_t *__json_object_insert(const char *name,
int type, va_list ap,
struct list_head *pos,
Expand Down
2 changes: 2 additions & 0 deletions src/util/json_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ const char *json_object_prev_name(const char *name,
const json_object_t *obj);
const json_value_t *json_object_prev_value(const json_value_t *val,
const json_object_t *obj);
const char *json_object_value_name(const json_value_t *val,
const json_object_t *obj);
const json_value_t *json_object_append(json_object_t *obj,
const char *name,
int type, ...);
Expand Down

0 comments on commit 0c15ff4

Please sign in to comment.