ref: 64978dd4426c1788f06ff9065f6d49c6ffc8391b
parent: 7c452f09cf633586b26565139943844c682e2177
author: kvik <[email protected]>
date: Sat Feb 6 17:42:41 EST 2021
lptree: fix build by wrapping ctype.h macros in functions Plan 9 implements the ctype.h interface as function-like macros, which cannot be passed around as function pointers.
--- a/lptree.c
+++ b/lptree.c
@@ -1225,6 +1225,17 @@
lua_setfield(L, -2, catname);
}
+static int fn_isalnum (int c) {return isalnum(c);}
+static int fn_isalpha (int c) {return isalpha(c);}
+static int fn_iscntrl (int c) {return iscntrl(c);}
+static int fn_isdigit (int c) {return isdigit(c);}
+static int fn_isgraph (int c) {return isgraph(c);}
+static int fn_islower (int c) {return islower(c);}
+static int fn_isprint (int c) {return isprint(c);}
+static int fn_ispunct (int c) {return ispunct(c);}
+static int fn_isspace (int c) {return isspace(c);}
+static int fn_isupper (int c) {return isupper(c);}
+static int fn_isxdigit (int c) {return isxdigit(c);}
static int lp_locale (lua_State *L) {
if (lua_isnoneornil(L, 1)) {
@@ -1235,17 +1246,17 @@
luaL_checktype(L, 1, LUA_TTABLE);
lua_settop(L, 1);
}
- createcat(L, "alnum", isalnum);
- createcat(L, "alpha", isalpha);
- createcat(L, "cntrl", iscntrl);
- createcat(L, "digit", isdigit);
- createcat(L, "graph", isgraph);
- createcat(L, "lower", islower);
- createcat(L, "print", isprint);
- createcat(L, "punct", ispunct);
- createcat(L, "space", isspace);
- createcat(L, "upper", isupper);
- createcat(L, "xdigit", isxdigit);
+ createcat(L, "alnum", fn_isalnum);
+ createcat(L, "alpha", fn_isalpha);
+ createcat(L, "cntrl", fn_iscntrl);
+ createcat(L, "digit", fn_isdigit);
+ createcat(L, "graph", fn_isgraph);
+ createcat(L, "lower", fn_islower);
+ createcat(L, "print", fn_isprint);
+ createcat(L, "punct", fn_ispunct);
+ createcat(L, "space", fn_isspace);
+ createcat(L, "upper", fn_isupper);
+ createcat(L, "xdigit", fn_isxdigit);
return 1;
}