aboutsummaryrefslogtreecommitdiff
path: root/src/lj_clib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_clib.c')
-rw-r--r--src/lj_clib.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lj_clib.c b/src/lj_clib.c
index 23d1f182..263028e4 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 }
@@ -178,7 +179,7 @@ LJ_NORET LJ_NOINLINE static void clib_error(lua_State *L, const char *fmt,
178 if (!FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS|FORMAT_MESSAGE_FROM_SYSTEM, 179 if (!FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS|FORMAT_MESSAGE_FROM_SYSTEM,
179 NULL, err, 0, buf, sizeof(buf), NULL)) 180 NULL, err, 0, buf, sizeof(buf), NULL))
180 buf[0] = '\0'; 181 buf[0] = '\0';
181 lj_err_callermsg(L, lj_str_pushf(L, fmt, name, buf)); 182 lj_err_callermsg(L, lj_strfmt_pushf(L, fmt, name, buf));
182} 183}
183 184
184static int clib_needext(const char *s) 185static int clib_needext(const char *s)
@@ -193,7 +194,7 @@ static int clib_needext(const char *s)
193static const char *clib_extname(lua_State *L, const char *name) 194static const char *clib_extname(lua_State *L, const char *name)
194{ 195{
195 if (clib_needext(name)) { 196 if (clib_needext(name)) {
196 name = lj_str_pushf(L, "%s.dll", name); 197 name = lj_strfmt_pushf(L, "%s.dll", name);
197 L->top--; 198 L->top--;
198 } 199 }
199 return name; 200 return name;
@@ -266,7 +267,7 @@ static void *clib_getsym(CLibrary *cl, const char *name)
266LJ_NORET LJ_NOINLINE static void clib_error(lua_State *L, const char *fmt, 267LJ_NORET LJ_NOINLINE static void clib_error(lua_State *L, const char *fmt,
267 const char *name) 268 const char *name)
268{ 269{
269 lj_err_callermsg(L, lj_str_pushf(L, fmt, name, "no support for this OS")); 270 lj_err_callermsg(L, lj_strfmt_pushf(L, fmt, name, "no support for this OS"));
270} 271}
271 272
272static void *clib_loadlib(lua_State *L, const char *name, int global) 273static void *clib_loadlib(lua_State *L, const char *name, int global)
@@ -350,7 +351,7 @@ TValue *lj_clib_index(lua_State *L, CLibrary *cl, GCstr *name)
350 CTInfo cconv = ctype_cconv(ct->info); 351 CTInfo cconv = ctype_cconv(ct->info);
351 if (cconv == CTCC_FASTCALL || cconv == CTCC_STDCALL) { 352 if (cconv == CTCC_FASTCALL || cconv == CTCC_STDCALL) {
352 CTSize sz = clib_func_argsize(cts, ct); 353 CTSize sz = clib_func_argsize(cts, ct);
353 const char *symd = lj_str_pushf(L, 354 const char *symd = lj_strfmt_pushf(L,
354 cconv == CTCC_FASTCALL ? "@%s@%d" : "_%s@%d", 355 cconv == CTCC_FASTCALL ? "@%s@%d" : "_%s@%d",
355 sym, sz); 356 sym, sz);
356 L->top--; 357 L->top--;