Adding generic check against the function in addition to check for a problematic compiler.
Fixes: r1878: Make strnlen() visible in old versions of glibc.
Signed-off-by: Andrey Korolyov andrey@xdel.ru --- flash.h | 2 +- helpers.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/flash.h b/flash.h index 24861ba..3af4c43 100644 --- a/flash.h +++ b/flash.h @@ -260,7 +260,7 @@ void tolower_string(char *str); #ifdef __MINGW32__ char* strtok_r(char *str, const char *delim, char **nextp); #endif -#if defined(__DJGPP__) +#if defined(__DJGPP__) || ! defined(HAVE_STRNLEN) size_t strnlen(const char *str, size_t n); #endif
diff --git a/helpers.c b/helpers.c index 7a146c3..cdc87e0 100644 --- a/helpers.c +++ b/helpers.c @@ -92,7 +92,7 @@ char* strtok_r(char *str, const char *delim, char **nextp) #endif
/* There is no strnlen in DJGPP */ -#if defined(__DJGPP__) +#if defined(__DJGPP__) || ! defined(HAVE_STRNLEN) size_t strnlen(const char *str, size_t n) { size_t i;