diff options
author | Philipp Janda <siffiejoe@gmx.net> | 2016-02-05 13:50:08 +0100 |
---|---|---|
committer | Philipp Janda <siffiejoe@gmx.net> | 2016-02-05 13:50:08 +0100 |
commit | 2c732b8c8831e656863a40530de2548615fa1ceb (patch) | |
tree | cb0669c1fda87e41f353fea53fa202616805da4a /lprefix.h | |
parent | af8c4896960770c0268ac3281d0622a0c0694dc5 (diff) | |
download | lua-compat-5.3-2c732b8c8831e656863a40530de2548615fa1ceb.tar.gz lua-compat-5.3-2c732b8c8831e656863a40530de2548615fa1ceb.tar.bz2 lua-compat-5.3-2c732b8c8831e656863a40530de2548615fa1ceb.zip |
Simplify utf8 helper function.
There's no need for `compat_utf8_escape()` to be a vararg function.
Remove default templates from `package.path`.
Diffstat (limited to 'lprefix.h')
-rw-r--r-- | lprefix.h | 8 |
1 files changed, 1 insertions, 7 deletions
@@ -51,16 +51,10 @@ | |||
51 | 51 | ||
52 | #ifdef lutf8lib_c | 52 | #ifdef lutf8lib_c |
53 | # define luaopen_utf8 luaopen_compat53_utf8 | 53 | # define luaopen_utf8 luaopen_compat53_utf8 |
54 | # include <stdarg.h> | ||
55 | /* we don't support the %U format string of lua_pushfstring! | 54 | /* we don't support the %U format string of lua_pushfstring! |
56 | * code below adapted from the Lua 5.3 sources: | 55 | * code below adapted from the Lua 5.3 sources: |
57 | */ | 56 | */ |
58 | static const char *compat53_utf8_escape (lua_State* L, ...) { | 57 | static const char *compat53_utf8_escape (lua_State* L, long x) { |
59 | long x = 0; | ||
60 | va_list argp; | ||
61 | va_start(argp, L); | ||
62 | x = (long)va_arg(argp, long); | ||
63 | va_end(argp); | ||
64 | if (x < 0x80) { /* ASCII */ | 58 | if (x < 0x80) { /* ASCII */ |
65 | char c = (char)x; | 59 | char c = (char)x; |
66 | lua_pushlstring(L, &c, 1); | 60 | lua_pushlstring(L, &c, 1); |