diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2008-07-09 14:10:24 +1000 |
---|---|---|
committer | Gerald Van Baren <vanbaren@cideas.com> | 2008-08-24 22:20:49 -0400 |
commit | fc7758ee4f5782878f2e96876b7bc56cfee0ac66 (patch) | |
tree | d2b1bf6f4f5104265cfaccca64ac043955e2ff8a /libfdt/fdt_ro.c | |
parent | c66830263af19831f2b7db307f79d1943febf7f9 (diff) | |
download | u-boot-imx-fc7758ee4f5782878f2e96876b7bc56cfee0ac66.zip u-boot-imx-fc7758ee4f5782878f2e96876b7bc56cfee0ac66.tar.gz u-boot-imx-fc7758ee4f5782878f2e96876b7bc56cfee0ac66.tar.bz2 |
libfdt: Increase namespace-pollution paranoia
libfdt is supposed to easy to embed in projects all and sundry.
Often, it won't be practical to separate the embedded libfdt's
namespace from that of the surrounding project. Which means there can
be namespace conflicts between even libfdt's internal/static functions
and functions or macros coming from the surrounding project's headers
via libfdt_env.h.
This patch, therefore, renames a bunch of libfdt internal functions
and macros and makes a few other chances to reduce the chances of
namespace collisions with embedding projects. Specifically:
- Internal functions (even static ones) are now named _fdt_*()
- The type and (static) global for the error table in
fdt_strerror() gain an fdt_ prefix
- The unused macro PALIGN is removed
- The memeq and streq macros are removed and open-coded in the
users (they were only used once each)
- Other macros gain an FDT_ prefix
- To save some of the bulk from the previous change, an
FDT_TAGALIGN() macro is introduced, where FDT_TAGALIGN(x) ==
FDT_ALIGN(x, FDT_TAGSIZE)
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'libfdt/fdt_ro.c')
-rw-r--r-- | libfdt/fdt_ro.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c index 1c897c5..326d19c 100644 --- a/libfdt/fdt_ro.c +++ b/libfdt/fdt_ro.c @@ -59,8 +59,8 @@ #include "libfdt_internal.h" -static int nodename_eq(const void *fdt, int offset, - const char *s, int len) +static int _fdt_nodename_eq(const void *fdt, int offset, + const char *s, int len) { const char *p = fdt_offset_ptr(fdt, offset + FDT_TAGSIZE, len+1); @@ -86,7 +86,7 @@ const char *fdt_string(const void *fdt, int stroffset) int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size) { - CHECK_HEADER(fdt); + FDT_CHECK_HEADER(fdt); *address = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->address); *size = fdt64_to_cpu(_fdt_mem_rsv(fdt, n)->size); return 0; @@ -106,7 +106,7 @@ int fdt_subnode_offset_namelen(const void *fdt, int offset, { int depth; - CHECK_HEADER(fdt); + FDT_CHECK_HEADER(fdt); for (depth = 0; offset >= 0; @@ -114,7 +114,7 @@ int fdt_subnode_offset_namelen(const void *fdt, int offset, if (depth < 0) return -FDT_ERR_NOTFOUND; else if ((depth == 1) - && nodename_eq(fdt, offset, name, namelen)) + && _fdt_nodename_eq(fdt, offset, name, namelen)) return offset; } @@ -133,7 +133,7 @@ int fdt_path_offset(const void *fdt, const char *path) const char *p = path; int offset = 0; - CHECK_HEADER(fdt); + FDT_CHECK_HEADER(fdt); if (*path != '/') return -FDT_ERR_BADPATH; @@ -214,7 +214,7 @@ const struct fdt_property *fdt_get_property(const void *fdt, if (! prop) goto fail; namestroff = fdt32_to_cpu(prop->nameoff); - if (streq(fdt_string(fdt, namestroff), name)) { + if (strcmp(fdt_string(fdt, namestroff), name) == 0) { /* Found it! */ int len = fdt32_to_cpu(prop->len); prop = fdt_offset_ptr(fdt, offset, @@ -272,7 +272,7 @@ int fdt_get_path(const void *fdt, int nodeoffset, char *buf, int buflen) int offset, depth, namelen; const char *name; - CHECK_HEADER(fdt); + FDT_CHECK_HEADER(fdt); if (buflen < 2) return -FDT_ERR_NOSPACE; @@ -325,7 +325,7 @@ int fdt_supernode_atdepth_offset(const void *fdt, int nodeoffset, int offset, depth; int supernodeoffset = -FDT_ERR_INTERNAL; - CHECK_HEADER(fdt); + FDT_CHECK_HEADER(fdt); if (supernodedepth < 0) return -FDT_ERR_NOTFOUND; @@ -384,7 +384,7 @@ int fdt_node_offset_by_prop_value(const void *fdt, int startoffset, const void *val; int len; - CHECK_HEADER(fdt); + FDT_CHECK_HEADER(fdt); /* FIXME: The algorithm here is pretty horrible: we scan each * property of a node in fdt_getprop(), then if that didn't @@ -449,7 +449,7 @@ int fdt_node_offset_by_compatible(const void *fdt, int startoffset, { int offset, err; - CHECK_HEADER(fdt); + FDT_CHECK_HEADER(fdt); /* FIXME: The algorithm here is pretty horrible: we scan each * property of a node in fdt_node_check_compatible(), then if |