summaryrefslogtreecommitdiff
path: root/nasmlib.c
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.c
parent4a8daf06074351df2588a9f5cd2b4a558bde9935 (diff)
downloadnasm-fe501957c09a80347b1eb005ba1b1bc0fce14b0d.tar.gz
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.c')
-rw-r--r--nasmlib.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/nasmlib.c b/nasmlib.c
index 6f0e6afd..d045a2ae 100644
--- a/nasmlib.c
+++ b/nasmlib.c
@@ -6,6 +6,8 @@
* distributed in the NASM archive.
*/
+#include "compiler.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -144,7 +146,7 @@ char *nasm_strndup(char *s, size_t len)
return p;
}
-#if !defined(stricmp) && !defined(strcasecmp)
+#ifndef nasm_stricmp
int nasm_stricmp(const char *s1, const char *s2)
{
while (*s1 && tolower(*s1) == tolower(*s2))
@@ -158,7 +160,7 @@ int nasm_stricmp(const char *s1, const char *s2)
}
#endif
-#if !defined(strnicmp) && !defined(strncasecmp)
+#ifndef nasm_strnicmp
int nasm_strnicmp(const char *s1, const char *s2, int n)
{
while (n > 0 && *s1 && tolower(*s1) == tolower(*s2))
@@ -172,7 +174,7 @@ int nasm_strnicmp(const char *s1, const char *s2, int n)
}
#endif
-#if !defined(strsep)
+#ifndef nasm_strsep
char *nasm_strsep(char **stringp, const char *delim)
{
char *s = *stringp;