diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-09-14 15:03:05 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-09-14 16:24:54 +0100 |
commit | 6273edc2e7179a4bd1a542de69871084e1f18daa (patch) | |
tree | 67a85b6760a68df2bff404107fc260dfefeb6b32 /source/fitz/tree.c | |
parent | d79f72365de5b27b31953f614eb35f8a18b91247 (diff) | |
download | mupdf-6273edc2e7179a4bd1a542de69871084e1f18daa.tar.xz |
Add scripts to remove/replace 'static' from functions.
Getting a backtrace out with missing functions makes the
backtrace much less useful. Some backtrace routines (such
as that used by Memento on Android) are incapable of
resolving static functions.
We therefore provide 2 scripts (scripts/destatic.sh and
scripts/restatic.sh) that respectively remove and replace
the 'static' from function definitions.
The scripts do not affect "static inline" or "static const"
definitions, and they are are restricted to working in the
source directory (excluding source/tools), thirdparty/mujs
and the platform/{java,android} directories.
The transformed source should NOT be checked in.
To avoid problems with clashing symbols, some functions are
renamed or tweaked slightly in this patch.
Diffstat (limited to 'source/fitz/tree.c')
-rw-r--r-- | source/fitz/tree.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/source/fitz/tree.c b/source/fitz/tree.c index 18fb6548..9547dd2f 100644 --- a/source/fitz/tree.c +++ b/source/fitz/tree.c @@ -10,14 +10,14 @@ struct fz_tree_s int level; }; -static fz_tree sentinel = { "", NULL, &sentinel, &sentinel, 0 }; +static fz_tree tree_sentinel = { "", NULL, &tree_sentinel, &tree_sentinel, 0 }; static fz_tree *fz_tree_new_node(fz_context *ctx, const char *key, void *value) { fz_tree *node = fz_malloc_struct(ctx, fz_tree); node->key = fz_strdup(ctx, key); node->value = value; - node->left = node->right = &sentinel; + node->left = node->right = &tree_sentinel; node->level = 1; return node; } @@ -26,7 +26,7 @@ void *fz_tree_lookup(fz_context *ctx, fz_tree *node, const char *key) { if (node) { - while (node != &sentinel) + while (node != &tree_sentinel) { int c = strcmp(key, node->key); if (c == 0) @@ -72,7 +72,7 @@ static fz_tree *fz_tree_split(fz_tree *node) fz_tree *fz_tree_insert(fz_context *ctx, fz_tree *node, const char *key, void *value) { - if (node && node != &sentinel) + if (node && node != &tree_sentinel) { int c = strcmp(key, node->key); if (c < 0) @@ -93,9 +93,9 @@ void fz_drop_tree(fz_context *ctx, fz_tree *node, void (*dropfunc)(fz_context *c { if (node) { - if (node->left != &sentinel) + if (node->left != &tree_sentinel) fz_drop_tree(ctx, node->left, dropfunc); - if (node->right != &sentinel) + if (node->right != &tree_sentinel) fz_drop_tree(ctx, node->right, dropfunc); fz_free(ctx, node->key); if (dropfunc) @@ -106,19 +106,19 @@ void fz_drop_tree(fz_context *ctx, fz_tree *node, void (*dropfunc)(fz_context *c static void print_tree_imp(fz_context *ctx, fz_tree *node, int level) { int i; - if (node->left != &sentinel) + if (node->left != &tree_sentinel) print_tree_imp(ctx, node->left, level + 1); for (i = 0; i < level; i++) putchar(' '); printf("%s = %p (%d)\n", node->key, node->value, node->level); - if (node->right != &sentinel) + if (node->right != &tree_sentinel) print_tree_imp(ctx, node->right, level + 1); } void fz_debug_tree(fz_context *ctx, fz_tree *root) { printf("--- tree dump ---\n"); - if (root && root != &sentinel) + if (root && root != &tree_sentinel) print_tree_imp(ctx, root, 0); printf("---\n"); } |