From 44d4339eb335b6d6f7a8ffad6846e82aba90b233 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 16 Oct 2014 23:20:52 -0700 Subject: Don't use macros, and eliminate an include of . This avoids locale-dependent tests, and fixes cases where we passed signed char values to those macros (which is not safe with char being signed, as it is on most, but not all, platforms). Change-Id: I51d9716fe3eb02a6e98208334285c07597a6be79 Reviewed-on: https://code.wireshark.org/review/4761 Reviewed-by: Guy Harris --- epan/wslua/wslua_struct.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'epan/wslua') diff --git a/epan/wslua/wslua_struct.c b/epan/wslua/wslua_struct.c index db7e957a9c..e6b5471eb9 100644 --- a/epan/wslua/wslua_struct.c +++ b/epan/wslua/wslua_struct.c @@ -77,7 +77,6 @@ #include -#include #include #include #include @@ -212,13 +211,13 @@ typedef struct Header { /* For options that take a number argument, gets the number */ static int getnum (const gchar **fmt, int df) { - if (!isdigit(**fmt)) /* no number? */ + if (!g_ascii_isdigit(**fmt)) /* no number? */ return df; /* return default value */ else { int a = 0; do { a = a*10 + *((*fmt)++) - '0'; - } while (isdigit(**fmt)); + } while (g_ascii_isdigit(**fmt)); return a; } } @@ -484,7 +483,7 @@ WSLUA_CONSTRUCTOR Struct_unpack (lua_State *L) { switch (opt) { case 'b': case 'B': case 'h': case 'H': case 'l': case 'L': case 'T': case 'i': case 'I': { /* integer types */ - int issigned = islower(opt); + int issigned = g_ascii_islower(opt); lua_Number res = getinteger(data+pos, h.endian, issigned, (int)size); lua_pushnumber(L, res); break; @@ -563,7 +562,7 @@ WSLUA_CONSTRUCTOR Struct_size (lua_State *L) { luaL_argerror(L, 1, "option 's' has no fixed size"); else if (opt == 'c' && size == 0) luaL_argerror(L, 1, "option 'c0' has no fixed size"); - if (!isalnum(opt)) + if (!g_ascii_isalnum(opt)) controloptions(L, opt, &fmt, &h); pos += size; } @@ -599,7 +598,7 @@ WSLUA_CONSTRUCTOR Struct_values (lua_State *L) { default: break; } - if (!isalnum(opt)) + if (!g_ascii_isalnum(opt)) controloptions(L, opt, &fmt, &h); else if (size && !h.noassign) vals++; -- cgit v1.2.1