From: andy Date: Sun, 1 Feb 2004 17:47:08 +0000 (+0000) Subject: Yank the MSVC special handling. It turns out it was becuase "strlen" X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c9e53d5a30a353ead78dda3cd7e625f2ffee867e;p=simgear.git 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. --- diff --git a/simgear/nasal/lib.c b/simgear/nasal/lib.c index f9768d52..7597742c 100644 --- a/simgear/nasal/lib.c +++ b/simgear/nasal/lib.c @@ -1,14 +1,14 @@ #include "nasal.h" -#ifndef _MSC_VER // No need to include 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