Yank the MSVC special handling. It turns out it was becuase "strlen"

has special voodoo in the parser.  That's much more cleanly handled by
renaming the function than by #ifdef'ing.
This commit is contained in:
andy
2004-02-01 17:47:08 +00:00
parent 828e10773c
commit c9e53d5a30
+5 -5
View File
@@ -1,14 +1,14 @@
#include "nasal.h" #include "nasal.h"
#ifndef _MSC_VER
// No need to include <string.h> just for this: // No need to include <string.h> just for this:
static int strlen(char* s) // It needs a funny name because MSVC wants to treat "strlen" as a
// special symbol. Ugh...
static int StrLen(char* s)
{ {
char* s0 = s; char* s0 = s;
while(*s) s++; while(*s) s++;
return s - s0; return s - s0;
} }
#endif
static naRef size(naContext c, naRef args) static naRef size(naContext c, naRef args)
{ {
@@ -146,7 +146,7 @@ static naRef typeOf(naContext c, naRef args)
else if(naIsHash(r)) t = "hash"; else if(naIsHash(r)) t = "hash";
else if(naIsFunc(r)) t = "func"; else if(naIsFunc(r)) t = "func";
else if(naIsGhost(r)) t = "ghost"; else if(naIsGhost(r)) t = "ghost";
r = naStr_fromdata(naNewString(c), t, strlen(t)); r = naStr_fromdata(naNewString(c), t, StrLen(t));
return r; return r;
} }
@@ -174,7 +174,7 @@ naRef naStdLib(naContext c)
for(i=0; i<n; i++) { for(i=0; i<n; i++) {
naRef code = naNewCCode(c, funcs[i].func); naRef code = naNewCCode(c, funcs[i].func);
naRef name = naStr_fromdata(naNewString(c), naRef name = naStr_fromdata(naNewString(c),
funcs[i].name, strlen(funcs[i].name)); funcs[i].name, StrLen(funcs[i].name));
naHash_set(namespace, name, naNewFunc(c, code)); naHash_set(namespace, name, naNewFunc(c, code));
} }
return namespace; return namespace;