diff options
| author | 2009-01-12 20:04:40 +0100 | |
|---|---|---|
| committer | 2009-01-12 20:04:40 +0100 | |
| commit | c0c27eb5dc9c9f77cd5d500f36641647ee508d15 (patch) | |
| tree | ab39cbb030c302a89b180655723f2318ad07efd3 | |
| parent | 74dae54b1b092aca744b4df6668569d6fc1153b5 (diff) | |
| download | libplist-c0c27eb5dc9c9f77cd5d500f36641647ee508d15.tar.gz libplist-c0c27eb5dc9c9f77cd5d500f36641647ee508d15.tar.bz2 | |
Add a function to find a key node by its value.
| -rw-r--r-- | include/plist/plist.h | 1 | ||||
| -rw-r--r-- | src/plist.c | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/include/plist/plist.h b/include/plist/plist.h index 976408d..b666d2f 100644 --- a/include/plist/plist.h +++ b/include/plist/plist.h | |||
| @@ -73,6 +73,7 @@ plist_t plist_get_prev_sibling(plist_t node); | |||
| 73 | 73 | ||
| 74 | //utili function to find first (and only the first encountred) corresponding node | 74 | //utili function to find first (and only the first encountred) corresponding node |
| 75 | plist_t plist_find_node(plist_t plist, plist_type type, void *value, uint64_t length); | 75 | plist_t plist_find_node(plist_t plist, plist_type type, void *value, uint64_t length); |
| 76 | plist_t plist_find_node_by_key(plist_t plist, char *value); | ||
| 76 | plist_t plist_find_node_by_string(plist_t plist, char *value); | 77 | plist_t plist_find_node_by_string(plist_t plist, char *value); |
| 77 | 78 | ||
| 78 | void plist_get_type_and_value(plist_t node, plist_type * type, void *value, uint64_t * length); | 79 | void plist_get_type_and_value(plist_t node, plist_type * type, void *value, uint64_t * length); |
diff --git a/src/plist.c b/src/plist.c index adee262..e5cf2db 100644 --- a/src/plist.c +++ b/src/plist.c | |||
| @@ -194,6 +194,11 @@ plist_t plist_find_node(plist_t plist, plist_type type, void *value, uint64_t le | |||
| 194 | return NULL; | 194 | return NULL; |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | plist_t plist_find_node_by_key(plist_t plist, char *value) | ||
| 198 | { | ||
| 199 | return plist_find_node(plist, PLIST_KEY, value, strlen(value)); | ||
| 200 | } | ||
| 201 | |||
| 197 | plist_t plist_find_node_by_string(plist_t plist, char *value) | 202 | plist_t plist_find_node_by_string(plist_t plist, char *value) |
| 198 | { | 203 | { |
| 199 | return plist_find_node(plist, PLIST_STRING, value, strlen(value)); | 204 | return plist_find_node(plist, PLIST_STRING, value, strlen(value)); |
