summaryrefslogtreecommitdiff
path: root/nasmlib.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-10-02 21:53:51 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-10-02 21:53:51 -0700
commitfe501957c09a80347b1eb005ba1b1bc0fce14b0d (patch)
tree6747b0e256b60819125c652dd58577b12c71556e /nasmlib.h
parent4a8daf06074351df2588a9f5cd2b4a558bde9935 (diff)
downloadnasm-fe501957c09a80347b1eb005ba1b1bc0fce14b0d.tar.gz
nasm-fe501957c09a80347b1eb005ba1b1bc0fce14b0d.tar.bz2
nasm-fe501957c09a80347b1eb005ba1b1bc0fce14b0d.zip
Portability fixes
Concentrate compiler dependencies to compiler.h; make sure compiler.h is included first in every .c file (since some prototypes may depend on the presence of feature request macros.) Actually use the conditional inclusion of various functions (totally broken in previous releases.)
Diffstat (limited to 'nasmlib.h')
-rw-r--r--nasmlib.h25
1 files changed, 13 insertions, 12 deletions
diff --git a/nasmlib.h b/nasmlib.h
index a2544fc..64afa45 100644
--- a/nasmlib.h
+++ b/nasmlib.h
@@ -9,9 +9,14 @@
#ifndef NASM_NASMLIB_H
#define NASM_NASMLIB_H
+#include "compiler.h"
+
#include <inttypes.h>
#include <stdio.h>
-#include "compiler.h"
+#include <string.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
/*
* If this is defined, the wrappers around malloc et al will
@@ -98,27 +103,23 @@ char *nasm_strndup_log(char *, int, char *, size_t);
* ANSI doesn't guarantee the presence of `stricmp' or
* `strcasecmp'.
*/
-#if defined(stricmp) || defined(strcasecmp)
-#if defined(stricmp)
-#define nasm_stricmp stricmp
-#else
+#if defined(HAVE_STRCASECMP)
#define nasm_stricmp strcasecmp
-#endif
+#elif defined(HAVE_STRICMP)
+#define nasm_stricmp stricmp
#else
int nasm_stricmp(const char *, const char *);
#endif
-#if defined(strnicmp) || defined(strncasecmp)
-#if defined(strnicmp)
-#define nasm_strnicmp strnicmp
-#else
+#if defined(HAVE_STRNCASECMP)
#define nasm_strnicmp strncasecmp
-#endif
+#elif defined(HAVE_STRNICMP)
+#define nasm_strnicmp strnicmp
#else
int nasm_strnicmp(const char *, const char *, int);
#endif
-#if defined(strsep)
+#if defined(HAVE_STRSEP)
#define nasm_strsep strsep
#else
char *nasm_strsep(char **stringp, const char *delim);