Browse Source

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.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
main
David Gibson 16 years ago committed by Jon Loeliger
parent
commit
01a2d8a3e9
  1. 2
      data.c
  2. 4
      tests/dtbs_equal_ordered.c
  3. 2
      tests/get_name.c
  4. 4
      tests/get_path.c
  5. 2
      tests/get_phandle.c
  6. 2
      tests/incbin.c
  7. 6
      tests/mangle-layout.c
  8. 3
      tests/node_check_compatible.c
  9. 2
      tests/node_offset_by_compatible.c
  10. 2
      tests/node_offset_by_phandle.c
  11. 7
      tests/node_offset_by_prop_value.c
  12. 2
      tests/nopulate.c
  13. 2
      tests/notfound.c
  14. 4
      tests/parent_offset.c
  15. 2
      tests/path-references.c
  16. 2
      tests/path_offset.c
  17. 2
      tests/references.c
  18. 2
      tests/set_name.c
  19. 2
      tests/subnode_offset.c
  20. 10
      tests/supernode_atdepth_offset.c
  21. 2
      treesource.c

2
data.c

@ -217,7 +217,7 @@ struct data data_insert_at_marker(struct data d, struct marker *m, @@ -217,7 +217,7 @@ struct data data_insert_at_marker(struct data d, struct marker *m,
return 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;


4
tests/dtbs_equal_ordered.c

@ -29,7 +29,7 @@ @@ -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, const void *fdt2) @@ -56,7 +56,7 @@ void compare_mem_rsv(const void *fdt1, const void *fdt2)
}
}

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;

2
tests/get_name.c

@ -28,7 +28,7 @@ @@ -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;

4
tests/get_path.c

@ -30,7 +30,7 @@ @@ -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 char *path, int pathlen, int buflen) @@ -63,7 +63,7 @@ void check_path_buf(void *fdt, const char *path, int pathlen, int buflen)
FAIL("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);


2
tests/get_phandle.c

@ -28,7 +28,7 @@ @@ -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;

2
tests/incbin.c

@ -31,7 +31,7 @@ @@ -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;

6
tests/mangle-layout.c

@ -35,7 +35,7 @@ struct bufstate { @@ -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, int newsize) @@ -43,7 +43,7 @@ void expand_buf(struct bufstate *buf, int newsize)
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, int version, const void *fdt) @@ -63,7 +63,7 @@ void new_header(struct bufstate *buf, int version, const void *fdt)
fdt_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;

3
tests/node_check_compatible.c

@ -29,7 +29,8 @@ @@ -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;


2
tests/node_offset_by_compatible.c

@ -29,7 +29,7 @@ @@ -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;

2
tests/node_offset_by_phandle.c

@ -29,7 +29,7 @@ @@ -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;


7
tests/node_offset_by_prop_value.c

@ -29,7 +29,7 @@ @@ -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 *propname, const void *propval, @@ -48,7 +48,7 @@ void vcheck_search(void *fdt, const char *propname, const void *propval,
} 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 char *propname, const void *propval, @@ -58,7 +58,8 @@ void check_search(void *fdt, const char *propname, const void *propval,
va_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;


2
tests/nopulate.c

@ -30,7 +30,7 @@ @@ -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;

2
tests/notfound.c

@ -28,7 +28,7 @@ @@ -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,

4
tests/parent_offset.c

@ -28,7 +28,7 @@ @@ -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) @@ -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;

2
tests/path-references.c

@ -28,7 +28,7 @@ @@ -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;

2
tests/path_offset.c

@ -28,7 +28,7 @@ @@ -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;

2
tests/references.c

@ -28,7 +28,7 @@ @@ -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;

2
tests/set_name.c

@ -28,7 +28,7 @@ @@ -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;

2
tests/subnode_offset.c

@ -28,7 +28,7 @@ @@ -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;

10
tests/supernode_atdepth_offset.c

@ -28,7 +28,7 @@ @@ -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) @@ -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 depth) @@ -67,7 +67,7 @@ int path_prefix(const char *path, int depth)
return 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_header *fdt, const char *path, @@ -106,7 +106,7 @@ void check_supernode_atdepth(struct fdt_header *fdt, const char *path,
"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 fdt_header *fdt, const char *path) @@ -121,7 +121,7 @@ void check_supernode_overdepth(struct fdt_header *fdt, const char *path)
"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;


2
treesource.c

@ -52,7 +52,7 @@ static void write_prefix(FILE *f, int level) @@ -52,7 +52,7 @@ static void write_prefix(FILE *f, int level)
fputc('\t', f);
}

int isstring(char c)
static int isstring(char c)
{
return (isprint(c)
|| (c == '\0')

Loading…
Cancel
Save