Implement the strnlen() function if it isn't implemented. Signed-off-by: John Arbuckle <programmingk...@gmail.com> --- libfdt/fdt_ro.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c index 3d00d2e..a7986fb 100644 --- a/libfdt/fdt_ro.c +++ b/libfdt/fdt_ro.c @@ -55,6 +55,30 @@ #include "libfdt_internal.h" +/* if the current environment does not define strnlen */ +#ifndef strnlen + +/* This eliminates the missing prototype warning */ +int strnlen(const char *string, int max_count); + +/* + * strnlen: return the length of a string or max_count + * which ever is shortest + */ + +int strnlen(const char *string, int max_count) +{ + int count; + for(count = 0; count < max_count; count++) { + if (string[count] == '\0') { + break; + } + } + return count; +} + +#endif /* strnlen */ + static int _fdt_nodename_eq(const void *fdt, int offset, const char *s, int len) { -- 2.13.5 (Apple Git-94)