summaryrefslogtreecommitdiffstats
path: root/src/oplist.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/oplist.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/oplist.c')
-rw-r--r--src/oplist.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/oplist.c b/src/oplist.c
index 420cbd6..287d5a2 100644
--- a/src/oplist.c
+++ b/src/oplist.c
@@ -34,7 +34,6 @@
34#include <limits.h> 34#include <limits.h>
35 35
36#include <node.h> 36#include <node.h>
37#include <node_list.h>
38 37
39#include "plist.h" 38#include "plist.h"
40#include "strbuf.h" 39#include "strbuf.h"
@@ -130,7 +129,7 @@ static int str_needs_quotes(const char* str, size_t len)
130 return 0; 129 return 0;
131} 130}
132 131
133static int node_to_openstep(node_t* node, bytearray_t **outbuf, uint32_t depth, int prettify) 132static int node_to_openstep(node_t node, bytearray_t **outbuf, uint32_t depth, int prettify)
134{ 133{
135 plist_data_t node_data = NULL; 134 plist_data_t node_data = NULL;
136 135
@@ -209,7 +208,7 @@ static int node_to_openstep(node_t* node, bytearray_t **outbuf, uint32_t depth,
209 208
210 case PLIST_ARRAY: { 209 case PLIST_ARRAY: {
211 str_buf_append(*outbuf, "(", 1); 210 str_buf_append(*outbuf, "(", 1);
212 node_t *ch; 211 node_t ch;
213 uint32_t cnt = 0; 212 uint32_t cnt = 0;
214 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) { 213 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) {
215 if (cnt > 0) { 214 if (cnt > 0) {
@@ -237,7 +236,7 @@ static int node_to_openstep(node_t* node, bytearray_t **outbuf, uint32_t depth,
237 } break; 236 } break;
238 case PLIST_DICT: { 237 case PLIST_DICT: {
239 str_buf_append(*outbuf, "{", 1); 238 str_buf_append(*outbuf, "{", 1);
240 node_t *ch; 239 node_t ch;
241 uint32_t cnt = 0; 240 uint32_t cnt = 0;
242 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) { 241 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) {
243 if (cnt > 0 && cnt % 2 == 0) { 242 if (cnt > 0 && cnt % 2 == 0) {
@@ -346,7 +345,7 @@ static int num_digits_u(uint64_t i)
346 return n; 345 return n;
347} 346}
348 347
349static int node_estimate_size(node_t *node, uint64_t *size, uint32_t depth, int prettify) 348static int node_estimate_size(node_t node, uint64_t *size, uint32_t depth, int prettify)
350{ 349{
351 plist_data_t data; 350 plist_data_t data;
352 if (!node) { 351 if (!node) {
@@ -354,7 +353,7 @@ static int node_estimate_size(node_t *node, uint64_t *size, uint32_t depth, int
354 } 353 }
355 data = plist_get_data(node); 354 data = plist_get_data(node);
356 if (node->children) { 355 if (node->children) {
357 node_t *ch; 356 node_t ch;
358 unsigned int n_children = node_n_children(node); 357 unsigned int n_children = node_n_children(node);
359 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) { 358 for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) {
360 int res = node_estimate_size(ch, size, depth + 1, prettify); 359 int res = node_estimate_size(ch, size, depth + 1, prettify);