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:
parent
828e10773c
commit
c9e53d5a30
@ -1,14 +1,14 @@
|
||||
#include "nasal.h"
|
||||
|
||||
#ifndef _MSC_VER
|
||||
// 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;
|
||||
while(*s) s++;
|
||||
return s - s0;
|
||||
}
|
||||
#endif
|
||||
|
||||
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(naIsFunc(r)) t = "func";
|
||||
else if(naIsGhost(r)) t = "ghost";
|
||||
r = naStr_fromdata(naNewString(c), t, strlen(t));
|
||||
r = naStr_fromdata(naNewString(c), t, StrLen(t));
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ naRef naStdLib(naContext c)
|
||||
for(i=0; i<n; i++) {
|
||||
naRef code = naNewCCode(c, funcs[i].func);
|
||||
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));
|
||||
}
|
||||
return namespace;
|
||||
|
Loading…
Reference in New Issue
Block a user