From 230f253e9b187efd67787f98639aadb15916d0e9 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Mon, 29 Aug 2005 12:48:02 +1000 Subject: [PATCH] Remove an unused function, mark a bunch of other functions and variables as static. Mostly found by sparse. --- data.c | 18 ++---------------- flattree.c | 14 +++++++------- livetree.c | 6 +++--- treesource.c | 2 +- 4 files changed, 13 insertions(+), 27 deletions(-) diff --git a/data.c b/data.c index 9801037..c842396 100644 --- a/data.c +++ b/data.c @@ -101,21 +101,7 @@ struct data data_copy_mem(char *mem, int len) return d; } -char hexval(char c) -{ - switch (c) { - case '0' ... '9': - return c - '0'; - case 'a' ... 'f': - return c - 'a'; - case 'A' ... 'F': - return c - 'A'; - default: - assert(0); - } -} - -char get_oct_char(char *s, int *i) +static char get_oct_char(char *s, int *i) { char x[4]; char *endx; @@ -137,7 +123,7 @@ char get_oct_char(char *s, int *i) return val; } -char get_hex_char(char *s, int *i) +static char get_hex_char(char *s, int *i) { char x[3]; char *endx; diff --git a/flattree.c b/flattree.c index 408f8c6..62b8903 100644 --- a/flattree.c +++ b/flattree.c @@ -27,7 +27,7 @@ #define FTF_BOOTCPUID 0x8 #define FTF_STRTABSIZE 0x10 -struct version_info { +static struct version_info { int version; int last_comp_version; int hdr_size; @@ -100,7 +100,7 @@ static void bin_emit_property(void *e, char *label) bin_emit_cell(e, OF_DT_PROP); } -struct emitter bin_emitter = { +static struct emitter bin_emitter = { .cell = bin_emit_cell, .string = bin_emit_string, .align = bin_emit_align, @@ -110,7 +110,7 @@ struct emitter bin_emitter = { .property = bin_emit_property, }; -void emit_label(FILE *f, char *prefix, char *label) +static void emit_label(FILE *f, char *prefix, char *label) { fprintf(f, "\t.globl\t%s_%s\n", prefix, label); fprintf(f, "%s_%s:\n", prefix, label); @@ -207,7 +207,7 @@ static void asm_emit_property(void *e, char *label) fprintf(f, "\t.long\tOF_DT_PROP\n"); } -struct emitter asm_emitter = { +static struct emitter asm_emitter = { .cell = asm_emit_cell, .string = asm_emit_string, .align = asm_emit_align, @@ -369,7 +369,7 @@ void write_dt_blob(FILE *f, struct boot_info *bi, int version) data_free(strbuf); } -void dump_stringtable_asm(FILE *f, struct data strbuf) +static void dump_stringtable_asm(FILE *f, struct data strbuf) { char *p; int len; @@ -561,8 +561,8 @@ static char *flat_read_stringtable(struct inbuf *inb, int offset) return strdup(inb->base + offset); } -struct property *flat_read_property(struct inbuf *dtbuf, struct inbuf *strbuf, - int flags) +static struct property *flat_read_property(struct inbuf *dtbuf, + struct inbuf *strbuf, int flags) { u32 proplen, stroff; char *name; diff --git a/livetree.c b/livetree.c index ece2273..1db6971 100644 --- a/livetree.c +++ b/livetree.c @@ -97,7 +97,7 @@ void add_child(struct node *parent, struct node *child) * Tree accessor functions */ -char *get_unitname(struct node *node) +static char *get_unitname(struct node *node) { if (node->name[node->basenamelen] == '\0') return ""; @@ -105,7 +105,7 @@ char *get_unitname(struct node *node) return node->name + node->basenamelen + 1; } -struct property *get_property(struct node *node, char *propname) +static struct property *get_property(struct node *node, char *propname) { struct property *prop; @@ -226,7 +226,7 @@ static int name_prop_check(struct property *prop, struct node *node) return 1; } -struct { +static struct { char *propname; int (*check_fn)(struct property *prop, struct node *node); } prop_checker_table[] = { diff --git a/treesource.c b/treesource.c index ee0a7b8..14e9e27 100644 --- a/treesource.c +++ b/treesource.c @@ -91,7 +91,7 @@ static enum proptype guess_type(struct property *prop) } -void write_tree_source_node(FILE *f, struct node *tree, int level) +static void write_tree_source_node(FILE *f, struct node *tree, int level) { struct property *prop; struct node *child;