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 | |
| 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`.
| -rw-r--r-- | lprefix.h | 8 | ||||
| -rwxr-xr-x | tests/test.lua | 2 |
2 files changed, 2 insertions, 8 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); |
diff --git a/tests/test.lua b/tests/test.lua index f2094b9..8adad1a 100755 --- a/tests/test.lua +++ b/tests/test.lua | |||
| @@ -42,7 +42,7 @@ if arg[1] == "module" then | |||
| 42 | end | 42 | end |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | package.path = "../?.lua;../?/init.lua;"..package.path | 45 | package.path = "../?.lua;../?/init.lua" |
| 46 | package.cpath = "./?-"..V..".so;./?-"..V..".dll;./?.so;./?.dll" | 46 | package.cpath = "./?-"..V..".so;./?-"..V..".dll;./?.so;./?.dll" |
| 47 | if mode == "module" then | 47 | if mode == "module" then |
| 48 | print("testing Lua API using `compat53.module` ...") | 48 | print("testing Lua API using `compat53.module` ...") |
