dtc: Make many functions 'static'
This patch marks various functions not shared between c files 'static', as they should be. There are a couple of functions in dtc, and many in the testsuite.
This is *almost* enough to enable the -Wmissing-prototypes warning. It's not quite enough, because there's a mess of junk in the flex generated code which triggers that warning which I'm not yet sure how to deal with.
data.c +1 -1
@@ -217,7 +217,7 @@ struct data data_insert_at_marker(structreturn d; } -struct data data_append_markers (struct data d,struct marker *m) +static struct data data_append_markers (struct data d,struct marker *m) {struct marker **mp = &d.markers;
tests/get_name.c +1 -1
@@ -28,7 +28,7 @@#include "tests.h" #include "testdata.h" -void check_name (void *fdt,const char *path) +static void check_name (void *fdt,const char *path) {int offset;const char *getname, *getname2, *checkname;
tests/get_path.c +2 -2
@@ -30,7 +30,7 @@#define POISON ('\xff') -void check_path_buf (void *fdt,const char *path,int pathlen,int buflen) +static void check_path_buf (void *fdt,const char *path,int pathlen,int buflen) {int offset;char buf[buflen+1 ];
@@ -63,7 +63,7 @@ void check_path_buf(void *fdt, const chaFAIL ("fdt_get_path([%d bytes]) overran buffer" , buflen); } -void check_path (void *fdt,const char *path) +static void check_path (void *fdt,const char *path) {int pathlen =strlen (path);
tests/get_phandle.c +1 -1
@@ -28,7 +28,7 @@#include "tests.h" #include "testdata.h" -void check_phandle (void *fdt,const char *path,uint32_t checkhandle) +static void check_phandle (void *fdt,const char *path,uint32_t checkhandle) {int offset;uint32_t phandle;
tests/node_offset_by_prop_value.c +4 -3
@@ -29,7 +29,7 @@#include "tests.h" #include "testdata.h" -void vcheck_search (void *fdt,const char *propname,const void *propval, +static void vcheck_search (void *fdt,const char *propname,const void *propval,int proplen,va_list ap) {int offset =-1 , target;
@@ -48,7 +48,7 @@ void vcheck_search(void *fdt, const char }while (target >=0 ); } -void check_search (void *fdt,const char *propname,const void *propval, +static void check_search (void *fdt,const char *propname,const void *propval,int proplen, ...) {va_list ap;
@@ -58,7 +58,8 @@ void check_search(void *fdt, const charva_end (ap); } -void check_search_str (void *fdt,const char *propname,const char *propval, ...) +static void check_search_str (void *fdt,const char *propname, +const char *propval, ...) {va_list ap;
tests/parent_offset.c +2 -2
@@ -28,7 +28,7 @@#include "tests.h" #include "testdata.h" -int path_parent_len (const char *path) +static int path_parent_len (const char *path) {const char *p =strrchr (path,'/' );
@@ -40,7 +40,7 @@ int path_parent_len(const char *path)return p - path; } -void check_path (struct fdt_header *fdt,const char *path) +static void check_path (struct fdt_header *fdt,const char *path) {char *parentpath;int nodeoffset, parentoffset, parentpathoffset, pathparentlen;
tests/path_offset.c +1 -1
@@ -28,7 +28,7 @@#include "tests.h" #include "testdata.h" -int check_subnode (void *fdt,int parent,const char *name) +static int check_subnode (void *fdt,int parent,const char *name) {int offset;const struct fdt_node_header *nh;
tests/subnode_offset.c +1 -1
@@ -28,7 +28,7 @@#include "tests.h" #include "testdata.h" -int check_subnode (struct fdt_header *fdt,int parent,const char *name) +static int check_subnode (struct fdt_header *fdt,int parent,const char *name) {int offset;const struct fdt_node_header *nh;
tests/supernode_atdepth_offset.c +5 -5
@@ -28,7 +28,7 @@#include "tests.h" #include "testdata.h" -int path_depth (const char *path) +static int path_depth (const char *path) {const char *p;int depth =0 ;
@@ -49,7 +49,7 @@ int path_depth(const char *path)return depth; } -int path_prefix (const char *path,int depth) +static int path_prefix (const char *path,int depth) {const char *p;int i;
@@ -67,7 +67,7 @@ int path_prefix(const char *path, int dereturn p - path; } -void check_supernode_atdepth (struct fdt_header *fdt,const char *path, +static void check_supernode_atdepth (struct fdt_header *fdt,const char *path,int depth) {int pdepth =path_depth (path);
@@ -106,7 +106,7 @@ void check_supernode_atdepth(struct fdt_ "instead of %d", nodedepth, pdepth); } -void check_supernode_overdepth (struct fdt_header *fdt,const char *path) +static void check_supernode_overdepth (struct fdt_header *fdt,const char *path) {int pdepth =path_depth (path);int nodeoffset, err;
@@ -121,7 +121,7 @@ void check_supernode_overdepth(struct fd "of FDT_ERR_NOTFOUND", path, pdepth+1, err); } -void check_path (struct fdt_header *fdt,const char *path) +static void check_path (struct fdt_header *fdt,const char *path) {int i;
treesource.c +1 -1
@@ -52,7 +52,7 @@ static void write_prefix(FILE *f, int lefputc ('\t' , f); } -int isstring (char c) +static int isstring (char c) {return (isprint (c) || (c == '\0')
tests/dtbs_equal_ordered.c +2 -2
@@ -29,7 +29,7 @@#include "tests.h" #include "testdata.h" -void compare_mem_rsv (const void *fdt1,const void *fdt2) +static void compare_mem_rsv (const void *fdt1,const void *fdt2) {int i;uint64_t addr1, size1, addr2, size2;
@@ -56,7 +56,7 @@ void compare_mem_rsv(const void *fdt1, c } } -void compare_structure (const void *fdt1,const void *fdt2) +static void compare_structure (const void *fdt1,const void *fdt2) {int nextoffset1 =0 , nextoffset2 =0 ;int offset1, offset2;
tests/incbin.c +1 -1
@@ -31,7 +31,7 @@#define CHUNKSIZE 1024 -char *load_file (const char *name,int *len) +static char *load_file (const char *name,int *len) {FILE *f;char *buf =NULL ;
tests/mangle-layout.c +3 -3
@@ -35,7 +35,7 @@ struct bufstate {int size; }; -void expand_buf (struct bufstate *buf,int newsize) +static void expand_buf (struct bufstate *buf,int newsize) { buf->buf =realloc (buf->buf, newsize);if (!buf->buf)
@@ -43,7 +43,7 @@ void expand_buf(struct bufstate *buf, in buf->size = newsize; } -void new_header (struct bufstate *buf,int version,const void *fdt) +static void new_header (struct bufstate *buf,int version,const void *fdt) {int hdrsize;
@@ -63,7 +63,7 @@ void new_header(struct bufstate *buf, infdt_set_boot_cpuid_phys (buf->buf,fdt_boot_cpuid_phys (fdt)); } -void add_block (struct bufstate *buf,int version,char block,const void *fdt) +static void add_block (struct bufstate *buf,int version,char block,const void *fdt) {int align, size;const void *src;
tests/node_check_compatible.c +2 -1
@@ -29,7 +29,8 @@#include "tests.h" #include "testdata.h" -void check_compatible (const void *fdt,const char *path,const char *compat) +static void check_compatible (const void *fdt,const char *path, +const char *compat) {int offset, err;
tests/node_offset_by_compatible.c +1 -1
@@ -29,7 +29,7 @@#include "tests.h" #include "testdata.h" -void check_search (void *fdt,const char *compat, ...) +static void check_search (void *fdt,const char *compat, ...) {va_list ap;int offset =-1 , target;
tests/node_offset_by_phandle.c +1 -1
@@ -29,7 +29,7 @@#include "tests.h" #include "testdata.h" -void check_search (void *fdt,uint32_t phandle,int target) +static void check_search (void *fdt,uint32_t phandle,int target) {int offset;
tests/nopulate.c +1 -1
@@ -30,7 +30,7 @@#include "tests.h" #include "testdata.h" -int nopulate_struct (char *buf,const char *fdt) +static int nopulate_struct (char *buf,const char *fdt) {int offset, nextoffset =0 ;uint32_t tag;
tests/notfound.c +1 -1
@@ -28,7 +28,7 @@#include "tests.h" #include "testdata.h" -void check_error (const char *s,int err) +static void check_error (const char *s,int err) {if (err != -FDT_ERR_NOTFOUND ) FAIL("%s return error %s instead of -FDT_ERR_NOTFOUND", s,
tests/path-references.c +1 -1
@@ -28,7 +28,7 @@#include "tests.h" #include "testdata.h" -void check_ref (const void *fdt,int node,const char *checkpath) +static void check_ref (const void *fdt,int node,const char *checkpath) {const char *p;int len;
tests/references.c +1 -1
@@ -28,7 +28,7 @@#include "tests.h" #include "testdata.h" -void check_ref (const void *fdt,int node,uint32_t checkref) +static void check_ref (const void *fdt,int node,uint32_t checkref) {const uint32_t *p;uint32_t ref;
tests/set_name.c +1 -1
@@ -28,7 +28,7 @@#include "tests.h" #include "testdata.h" -void check_set_name (void *fdt,const char *path,const char *newname) +static void check_set_name (void *fdt,const char *path,const char *newname) {int offset;const char *getname, *oldname;
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Jon Loeliger
AppliedQuoted 10 lines
This patch marks various functions not shared between c files 'static', as they should be. There are a couple of functions in dtc, and many in the testsuite.
This is *almost* enough to enable the -Wmissing-prototypes warning. It's not quite enough, because there's a mess of junk in the flex generated code which triggers that warning which I'm not yet sure how to deal with.
Signed-off-by David Gibson <[email protected]>
Applied.
jdl