aboutsummaryrefslogtreecommitdiff
path: root/src/lj_meta.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lj_meta.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lj_meta.c b/src/lj_meta.c
index e11f1b75..db1ce928 100644
--- a/src/lj_meta.c
+++ b/src/lj_meta.c
@@ -12,6 +12,7 @@
12#include "lj_obj.h" 12#include "lj_obj.h"
13#include "lj_gc.h" 13#include "lj_gc.h"
14#include "lj_err.h" 14#include "lj_err.h"
15#include "lj_buf.h"
15#include "lj_str.h" 16#include "lj_str.h"
16#include "lj_tab.h" 17#include "lj_tab.h"
17#include "lj_meta.h" 18#include "lj_meta.h"
@@ -283,7 +284,7 @@ TValue *lj_meta_cat(lua_State *L, TValue *top, int left)
283 ** next step: [...][CAT stack ............] 284 ** next step: [...][CAT stack ............]
284 */ 285 */
285 MSize tlen = strV(top)->len; 286 MSize tlen = strV(top)->len;
286 char *buffer; 287 char *buf;
287 int i; 288 int i;
288 for (n = 1; n <= left && tostring(L, top-n); n++) { 289 for (n = 1; n <= left && tostring(L, top-n); n++) {
289 MSize len = strV(top-n)->len; 290 MSize len = strV(top-n)->len;
@@ -291,15 +292,15 @@ TValue *lj_meta_cat(lua_State *L, TValue *top, int left)
291 lj_err_msg(L, LJ_ERR_STROV); 292 lj_err_msg(L, LJ_ERR_STROV);
292 tlen += len; 293 tlen += len;
293 } 294 }
294 buffer = lj_str_needbuf(L, &G(L)->tmpbuf, tlen); 295 buf = lj_buf_tmp(L, tlen);
295 n--; 296 n--;
296 tlen = 0; 297 tlen = 0;
297 for (i = n; i >= 0; i--) { 298 for (i = n; i >= 0; i--) {
298 MSize len = strV(top-i)->len; 299 MSize len = strV(top-i)->len;
299 memcpy(buffer + tlen, strVdata(top-i), len); 300 memcpy(buf + tlen, strVdata(top-i), len);
300 tlen += len; 301 tlen += len;
301 } 302 }
302 setstrV(L, top-n, lj_str_new(L, buffer, tlen)); 303 setstrV(L, top-n, lj_str_new(L, buf, tlen));
303 } 304 }
304 left -= n; 305 left -= n;
305 top -= n; 306 top -= n;