diff options
| author | 2009-10-11 15:49:05 +0200 | |
|---|---|---|
| committer | 2009-10-11 15:49:05 +0200 | |
| commit | 393f1b4b2825b8cf6e67d22df8c255633696435f (patch) | |
| tree | d06639e4c5086d1958f6a4d6d5c1bc2a0d84a61f | |
| parent | 583bb249458fcca6cdf2581896681e618cf4547e (diff) | |
| download | libplist-393f1b4b2825b8cf6e67d22df8c255633696435f.tar.gz libplist-393f1b4b2825b8cf6e67d22df8c255633696435f.tar.bz2 | |
Restore plist_dict_get_size function.
| -rw-r--r-- | include/plist/plist.h | 8 | ||||
| -rw-r--r-- | src/plist.c | 9 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/plist/plist.h b/include/plist/plist.h index 55ae9e7..e12d6fa 100644 --- a/include/plist/plist.h +++ b/include/plist/plist.h | |||
| @@ -251,6 +251,14 @@ extern "C" { | |||
| 251 | ********************************************/ | 251 | ********************************************/ |
| 252 | 252 | ||
| 253 | /** | 253 | /** |
| 254 | * Get size of a #PLIST_DICT node. | ||
| 255 | * | ||
| 256 | * @param node the node of type #PLIST_DICT | ||
| 257 | * @return size of the #PLIST_DICT node | ||
| 258 | */ | ||
| 259 | PLIST_API uint32_t plist_dict_get_size(plist_t node); | ||
| 260 | |||
| 261 | /** | ||
| 254 | * Create iterator of a #PLIST_DICT node. | 262 | * Create iterator of a #PLIST_DICT node. |
| 255 | * The allocated iterator shoult be freed with tandard free function | 263 | * The allocated iterator shoult be freed with tandard free function |
| 256 | * | 264 | * |
diff --git a/src/plist.c b/src/plist.c index df98a7a..98ca34f 100644 --- a/src/plist.c +++ b/src/plist.c | |||
| @@ -267,6 +267,15 @@ void plist_array_remove_item(plist_t node, uint32_t n) | |||
| 267 | return; | 267 | return; |
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | uint32_t plist_dict_get_size(plist_t node) | ||
| 271 | { | ||
| 272 | uint32_t ret = 0; | ||
| 273 | if (node && PLIST_DICT == plist_get_node_type(node)) { | ||
| 274 | ret = g_node_n_children(node); | ||
| 275 | } | ||
| 276 | return ret; | ||
| 277 | } | ||
| 278 | |||
| 270 | void plist_dict_new_iter(plist_t node, plist_dict_iter *iter) | 279 | void plist_dict_new_iter(plist_t node, plist_dict_iter *iter) |
| 271 | { | 280 | { |
| 272 | if (iter && *iter == NULL) { | 281 | if (iter && *iter == NULL) { |
