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>
This commit is contained in:
David Gibson 2008-08-04 15:30:13 +10:00 committed by Jon Loeliger
parent 315c5d095e
commit 01a2d8a3e9
21 changed files with 34 additions and 32 deletions

2
data.c
View file

@ -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;

View file

@ -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)
}
}
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;

View file

@ -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;

View file

@ -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)
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);

View file

@ -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;

View file

@ -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;

View file

@ -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)
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)
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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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,
} 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,
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;

View file

@ -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;

View file

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

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

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

View file

@ -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')