summaryrefslogtreecommitdiffstats
path: root/src/bplist.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2023-02-06 18:28:28 +0100
committerGravatar Nikias Bassen2023-02-06 18:28:28 +0100
commitd3908006349f38bcfc0151daebd98b6873a2dbfc (patch)
tree238072fa5380039ad29af87c0d6e618ab37d4d5b /src/bplist.c
parent52826a6c229ed3e353d4dae711a6c52a96d99764 (diff)
downloadlibplist-d3908006349f38bcfc0151daebd98b6873a2dbfc.tar.gz
libplist-d3908006349f38bcfc0151daebd98b6873a2dbfc.tar.bz2
libcnary: Updated typedefs of node_t and node_list_t to contain pointer
This makes the code more readable. Obviously all the code that uses it is also updated.
Diffstat (limited to 'src/bplist.c')
-rw-r--r--src/bplist.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/bplist.c b/src/bplist.c
index c0d0fc8..ff0b399 100644
--- a/src/bplist.c
+++ b/src/bplist.c
@@ -191,7 +191,7 @@ static int uint64_mul_overflow(uint64_t a, uint64_t b, uint64_t *res)
191} 191}
192#endif 192#endif
193 193
194#define NODE_IS_ROOT(x) (((node_t*)(x))->isRoot) 194#define NODE_IS_ROOT(x) (((node_t)(x))->isRoot)
195 195
196struct bplist_data { 196struct bplist_data {
197 const char* data; 197 const char* data;
@@ -936,7 +936,7 @@ struct serialize_s
936 hashtable_t* ref_table; 936 hashtable_t* ref_table;
937}; 937};
938 938
939static void serialize_plist(node_t* node, void* data) 939static void serialize_plist(node_t node, void* data)
940{ 940{
941 uint64_t *index_val = NULL; 941 uint64_t *index_val = NULL;
942 struct serialize_s *ser = (struct serialize_s *) data; 942 struct serialize_s *ser = (struct serialize_s *) data;
@@ -959,7 +959,7 @@ static void serialize_plist(node_t* node, void* data)
959 ptr_array_add(ser->objects, node); 959 ptr_array_add(ser->objects, node);
960 960
961 //now recurse on children 961 //now recurse on children
962 node_t *ch; 962 node_t ch;
963 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) { 963 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) {
964 serialize_plist(ch, data); 964 serialize_plist(ch, data);
965 } 965 }
@@ -1111,9 +1111,9 @@ static void write_unicode(bytearray_t * bplist, char *val, uint64_t size)
1111 free(unicodestr); 1111 free(unicodestr);
1112} 1112}
1113 1113
1114static void write_array(bytearray_t * bplist, node_t* node, hashtable_t* ref_table, uint8_t ref_size) 1114static void write_array(bytearray_t * bplist, node_t node, hashtable_t* ref_table, uint8_t ref_size)
1115{ 1115{
1116 node_t* cur = NULL; 1116 node_t cur = NULL;
1117 uint64_t i = 0; 1117 uint64_t i = 0;
1118 1118
1119 uint64_t size = node_n_children(node); 1119 uint64_t size = node_n_children(node);
@@ -1130,9 +1130,9 @@ static void write_array(bytearray_t * bplist, node_t* node, hashtable_t* ref_tab
1130 } 1130 }
1131} 1131}
1132 1132
1133static void write_dict(bytearray_t * bplist, node_t* node, hashtable_t* ref_table, uint8_t ref_size) 1133static void write_dict(bytearray_t * bplist, node_t node, hashtable_t* ref_table, uint8_t ref_size)
1134{ 1134{
1135 node_t* cur = NULL; 1135 node_t cur = NULL;
1136 uint64_t i = 0; 1136 uint64_t i = 0;
1137 1137
1138 uint64_t size = node_n_children(node) / 2; 1138 uint64_t size = node_n_children(node) / 2;
@@ -1235,7 +1235,7 @@ PLIST_API plist_err_t plist_to_bin(plist_t plist, char **plist_bin, uint32_t * l
1235 uint64_t req = 0; 1235 uint64_t req = 0;
1236 for (i = 0; i < num_objects; i++) 1236 for (i = 0; i < num_objects; i++)
1237 { 1237 {
1238 node_t* node = ptr_array_index(objects, i); 1238 node_t node = ptr_array_index(objects, i);
1239 plist_data_t data = plist_get_data(node); 1239 plist_data_t data = plist_get_data(node);
1240 uint64_t size; 1240 uint64_t size;
1241 uint8_t bsize; 1241 uint8_t bsize;