diff options
Diffstat (limited to 'src/lj_clib.c')
-rw-r--r-- | src/lj_clib.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lj_clib.c b/src/lj_clib.c index ccb99e55..70e1c8f3 100644 --- a/src/lj_clib.c +++ b/src/lj_clib.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include "lj_cconv.h" | 16 | #include "lj_cconv.h" |
17 | #include "lj_cdata.h" | 17 | #include "lj_cdata.h" |
18 | #include "lj_clib.h" | 18 | #include "lj_clib.h" |
19 | #include "lj_strfmt.h" | ||
19 | 20 | ||
20 | /* -- OS-specific functions ----------------------------------------------- */ | 21 | /* -- OS-specific functions ----------------------------------------------- */ |
21 | 22 | ||
@@ -61,7 +62,7 @@ static const char *clib_extname(lua_State *L, const char *name) | |||
61 | #endif | 62 | #endif |
62 | ) { | 63 | ) { |
63 | if (!strchr(name, '.')) { | 64 | if (!strchr(name, '.')) { |
64 | name = lj_str_pushf(L, CLIB_SOEXT, name); | 65 | name = lj_strfmt_pushf(L, CLIB_SOEXT, name); |
65 | L->top--; | 66 | L->top--; |
66 | #ifdef __CYGWIN__ | 67 | #ifdef __CYGWIN__ |
67 | } else { | 68 | } else { |
@@ -70,7 +71,7 @@ static const char *clib_extname(lua_State *L, const char *name) | |||
70 | } | 71 | } |
71 | if (!(name[0] == CLIB_SOPREFIX[0] && name[1] == CLIB_SOPREFIX[1] && | 72 | if (!(name[0] == CLIB_SOPREFIX[0] && name[1] == CLIB_SOPREFIX[1] && |
72 | name[2] == CLIB_SOPREFIX[2])) { | 73 | name[2] == CLIB_SOPREFIX[2])) { |
73 | name = lj_str_pushf(L, CLIB_SOPREFIX "%s", name); | 74 | name = lj_strfmt_pushf(L, CLIB_SOPREFIX "%s", name); |
74 | L->top--; | 75 | L->top--; |
75 | } | 76 | } |
76 | } | 77 | } |
@@ -175,7 +176,7 @@ LJ_NORET LJ_NOINLINE static void clib_error(lua_State *L, const char *fmt, | |||
175 | if (!FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS|FORMAT_MESSAGE_FROM_SYSTEM, | 176 | if (!FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS|FORMAT_MESSAGE_FROM_SYSTEM, |
176 | NULL, err, 0, buf, sizeof(buf), NULL)) | 177 | NULL, err, 0, buf, sizeof(buf), NULL)) |
177 | buf[0] = '\0'; | 178 | buf[0] = '\0'; |
178 | lj_err_callermsg(L, lj_str_pushf(L, fmt, name, buf)); | 179 | lj_err_callermsg(L, lj_strfmt_pushf(L, fmt, name, buf)); |
179 | } | 180 | } |
180 | 181 | ||
181 | static int clib_needext(const char *s) | 182 | static int clib_needext(const char *s) |
@@ -190,7 +191,7 @@ static int clib_needext(const char *s) | |||
190 | static const char *clib_extname(lua_State *L, const char *name) | 191 | static const char *clib_extname(lua_State *L, const char *name) |
191 | { | 192 | { |
192 | if (clib_needext(name)) { | 193 | if (clib_needext(name)) { |
193 | name = lj_str_pushf(L, "%s.dll", name); | 194 | name = lj_strfmt_pushf(L, "%s.dll", name); |
194 | L->top--; | 195 | L->top--; |
195 | } | 196 | } |
196 | return name; | 197 | return name; |
@@ -263,7 +264,7 @@ static void *clib_getsym(CLibrary *cl, const char *name) | |||
263 | LJ_NORET LJ_NOINLINE static void clib_error(lua_State *L, const char *fmt, | 264 | LJ_NORET LJ_NOINLINE static void clib_error(lua_State *L, const char *fmt, |
264 | const char *name) | 265 | const char *name) |
265 | { | 266 | { |
266 | lj_err_callermsg(L, lj_str_pushf(L, fmt, name, "no support for this OS")); | 267 | lj_err_callermsg(L, lj_strfmt_pushf(L, fmt, name, "no support for this OS")); |
267 | } | 268 | } |
268 | 269 | ||
269 | static void *clib_loadlib(lua_State *L, const char *name, int global) | 270 | static void *clib_loadlib(lua_State *L, const char *name, int global) |
@@ -347,7 +348,7 @@ TValue *lj_clib_index(lua_State *L, CLibrary *cl, GCstr *name) | |||
347 | CTInfo cconv = ctype_cconv(ct->info); | 348 | CTInfo cconv = ctype_cconv(ct->info); |
348 | if (cconv == CTCC_FASTCALL || cconv == CTCC_STDCALL) { | 349 | if (cconv == CTCC_FASTCALL || cconv == CTCC_STDCALL) { |
349 | CTSize sz = clib_func_argsize(cts, ct); | 350 | CTSize sz = clib_func_argsize(cts, ct); |
350 | const char *symd = lj_str_pushf(L, | 351 | const char *symd = lj_strfmt_pushf(L, |
351 | cconv == CTCC_FASTCALL ? "@%s@%d" : "_%s@%d", | 352 | cconv == CTCC_FASTCALL ? "@%s@%d" : "_%s@%d", |
352 | sym, sz); | 353 | sym, sz); |
353 | L->top--; | 354 | L->top--; |