diff options
| author | 2026-02-12 02:10:19 +0100 | |
|---|---|---|
| committer | 2026-02-12 02:10:19 +0100 | |
| commit | a7e82b846543a4fc8d3291a5a65dd66b0cb84396 (patch) | |
| tree | 1b940620358f798b5f7fca41df9920f6b4948194 /include/plist | |
| parent | 4e82bc85671cfe50763de2637b54cb8576d7976f (diff) | |
| download | libplist-a7e82b846543a4fc8d3291a5a65dd66b0cb84396.tar.gz libplist-a7e82b846543a4fc8d3291a5a65dd66b0cb84396.tar.bz2 | |
plist: make array and dict iterators opaque
Introduce private iterator structs for plist_array_iter and
plist_dict_iter, and fix *_next_item() to properly advance
iterator state and handle malformed containers safely.
Diffstat (limited to 'include/plist')
| -rw-r--r-- | include/plist/plist.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/plist/plist.h b/include/plist/plist.h index 8ed9063..b46b9a9 100644 --- a/include/plist/plist.h +++ b/include/plist/plist.h | |||
| @@ -400,6 +400,12 @@ extern "C" | |||
| 400 | */ | 400 | */ |
| 401 | PLIST_API void plist_array_next_item(plist_t node, plist_array_iter iter, plist_t *item); | 401 | PLIST_API void plist_array_next_item(plist_t node, plist_array_iter iter, plist_t *item); |
| 402 | 402 | ||
| 403 | /** | ||
| 404 | * Free #PLIST_ARRAY iterator. | ||
| 405 | * | ||
| 406 | * @param iter Iterator to free. | ||
| 407 | */ | ||
| 408 | PLIST_API void plist_array_free_iter(plist_array_iter iter); | ||
| 403 | 409 | ||
| 404 | /******************************************** | 410 | /******************************************** |
| 405 | * * | 411 | * * |
| @@ -438,6 +444,13 @@ extern "C" | |||
| 438 | PLIST_API void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val); | 444 | PLIST_API void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val); |
| 439 | 445 | ||
| 440 | /** | 446 | /** |
| 447 | * Free #PLIST_DICT iterator. | ||
| 448 | * | ||
| 449 | * @param iter Iterator to free. | ||
| 450 | */ | ||
| 451 | PLIST_API void plist_dict_free_iter(plist_dict_iter iter); | ||
| 452 | |||
| 453 | /** | ||
| 441 | * Get key associated key to an item. Item must be member of a dictionary. | 454 | * Get key associated key to an item. Item must be member of a dictionary. |
| 442 | * | 455 | * |
| 443 | * @param node the item | 456 | * @param node the item |
