diff options
| author | 2019-05-20 01:10:48 +0200 | |
|---|---|---|
| committer | 2019-05-20 01:10:48 +0200 | |
| commit | ea37ed01b8c7e05078620ed039899ddff48eac1c (patch) | |
| tree | 00934c62f94a023cc2a18bf4feb601210c3f20f4 /src/plist.c | |
| parent | 9555e71d9887d0d5caf87341dc47d9ad313bb609 (diff) | |
| download | libplist-ea37ed01b8c7e05078620ed039899ddff48eac1c.tar.gz libplist-ea37ed01b8c7e05078620ed039899ddff48eac1c.tar.bz2 | |
Add plist_dict_item_get_key() to allow retrieving the key node for a given item of a #PLIST_DICT
Diffstat (limited to 'src/plist.c')
| -rw-r--r-- | src/plist.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/plist.c b/src/plist.c index dd659b8..29dbfb7 100644 --- a/src/plist.c +++ b/src/plist.c | |||
| @@ -618,6 +618,17 @@ PLIST_API void plist_dict_get_item_key(plist_t node, char **key) | |||
| 618 | } | 618 | } |
| 619 | } | 619 | } |
| 620 | 620 | ||
| 621 | PLIST_API plist_t plist_dict_item_get_key(plist_t node) | ||
| 622 | { | ||
| 623 | plist_t ret = NULL; | ||
| 624 | plist_t father = plist_get_parent(node); | ||
| 625 | if (PLIST_DICT == plist_get_node_type(father)) | ||
| 626 | { | ||
| 627 | ret = (plist_t)node_prev_sibling(node); | ||
| 628 | } | ||
| 629 | return ret; | ||
| 630 | } | ||
| 631 | |||
| 621 | PLIST_API plist_t plist_dict_get_item(plist_t node, const char* key) | 632 | PLIST_API plist_t plist_dict_get_item(plist_t node, const char* key) |
| 622 | { | 633 | { |
| 623 | plist_t ret = NULL; | 634 | plist_t ret = NULL; |
