diff options
author | H. Peter Anvin <hpa@zytor.com> | 2017-02-23 19:23:10 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2017-02-23 19:23:10 -0800 |
commit | 2958bcc6c283bbdcc5216f3873b5fe256aac104a (patch) | |
tree | c923dbb036b24e50d342b8553e5fb72fbe11afdb | |
parent | bc18af18f07869b637cb1072846d0068e6f2b43e (diff) | |
download | nasm-2958bcc6c283bbdcc5216f3873b5fe256aac104a.tar.gz |
compiler.h: correctly handle HAVE_DECL_*, test HAVE_DECL_STRNLEN
HAVE_DECL_* are 0/1 not ifdef; use HAVE_DECL_STRNLEN to see if we need
to declare this, lest stdlib/strnlen.c fails to compile.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | include/compiler.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/include/compiler.h b/include/compiler.h index 065ff214..e9a8de22 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -104,7 +104,7 @@ int vsnprintf(char *, size_t, const char *, va_list); # endif #endif -#if !defined(HAVE_STRLCPY) || !defined(HAVE_DECL_STRLCPY) +#if !defined(HAVE_STRLCPY) || !HAVE_DECL_STRLCPY size_t strlcpy(char *, const char *, size_t); #endif @@ -136,26 +136,30 @@ typedef enum bool { false, true } bool; #endif /* Some misguided platforms hide the defs for these */ -#if defined(HAVE_STRCASECMP) && !defined(HAVE_DECL_STRCASECMP) +#if defined(HAVE_STRCASECMP) && !HAVE_DECL_STRCASECMP int strcasecmp(const char *, const char *); #endif -#if defined(HAVE_STRICMP) && !defined(HAVE_DECL_STRICMP) +#if defined(HAVE_STRICMP) && !HAVE_DECL_STRICMP int stricmp(const char *, const char *); #endif -#if defined(HAVE_STRNCASECMP) && !defined(HAVE_DECL_STRNCASECMP) +#if defined(HAVE_STRNCASECMP) && !HAVE_DECL_STRNCASECMP int strncasecmp(const char *, const char *, size_t); #endif -#if defined(HAVE_STRNICMP) && !defined(HAVE_DECL_STRNICMP) +#if defined(HAVE_STRNICMP) && !HAVE_DECL_STRNICMP int strnicmp(const char *, const char *, size_t); #endif -#if defined(HAVE_STRSEP) && !defined(HAVE_DECL_STRSEP) +#if defined(HAVE_STRSEP) && !HAVE_DECL_STRSEP char *strsep(char **, const char *); #endif +#if !HAVE_DECL_STRNLEN +size_t strnlen(const char *s, size_t maxlen); +#endif + /* * Define this to 1 for faster performance if this is a littleendian * platform which can do unaligned memory references. It is safe |