Commit f8ba9f02 authored by Jonathan Beck's avatar Jonathan Beck

Abstract iter base type.

parent 97f7caee
...@@ -64,7 +64,7 @@ extern "C" { ...@@ -64,7 +64,7 @@ extern "C" {
/** /**
* The plist dictionary iterator. * The plist dictionary iterator.
*/ */
typedef uint32_t *plist_dict_iter; typedef void *plist_dict_iter;
/** /**
* The enumeration of plist node types. * The enumeration of plist node types.
......
...@@ -264,24 +264,24 @@ void plist_dict_new_iter(plist_t node, plist_dict_iter *iter) ...@@ -264,24 +264,24 @@ void plist_dict_new_iter(plist_t node, plist_dict_iter *iter)
{ {
if (iter && *iter == NULL) { if (iter && *iter == NULL) {
*iter = malloc(sizeof(uint32_t)); *iter = malloc(sizeof(uint32_t));
**iter = 0; *(uint32_t*)*iter = 0;
} }
return; return;
} }
void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val) void plist_dict_next_item(plist_t node, plist_dict_iter iter, char **key, plist_t *val)
{ {
if (node && PLIST_DICT == plist_get_node_type(node) && *iter < g_node_n_children(node) / 2) { if (node && PLIST_DICT == plist_get_node_type(node) && *(uint32_t*)iter < g_node_n_children(node) / 2) {
if (key) { if (key) {
plist_get_key_val((plist_t)g_node_nth_child(node, 2 * (*iter)), key); plist_get_key_val((plist_t)g_node_nth_child(node, 2 * (*(uint32_t*)iter)), key);
} }
if (val) { if (val) {
*val = (plist_t) g_node_nth_child(node, 2 * (*iter) + 1); *val = (plist_t) g_node_nth_child(node, 2 * (*(uint32_t*)iter) + 1);
} }
*iter += 2; *(uint32_t*)iter += 2;
} }
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment