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 2601af94..6cbfd927 100644
--- a/src/lj_meta.c
+++ b/src/lj_meta.c
@@ -20,6 +20,7 @@
20#include "lj_bc.h" 20#include "lj_bc.h"
21#include "lj_vm.h" 21#include "lj_vm.h"
22#include "lj_strscan.h" 22#include "lj_strscan.h"
23#include "lj_strfmt.h"
23#include "lj_lib.h" 24#include "lj_lib.h"
24 25
25/* -- Metamethod handling ------------------------------------------------- */ 26/* -- Metamethod handling ------------------------------------------------- */
@@ -269,10 +270,10 @@ TValue *lj_meta_cat(lua_State *L, TValue *top, int left)
269 ** next step: [...][CAT stack ............] 270 ** next step: [...][CAT stack ............]
270 */ 271 */
271 TValue *e, *o = top; 272 TValue *e, *o = top;
272 uint64_t tlen = tvisstr(o) ? strV(o)->len : LJ_STR_NUMBERBUF; 273 uint64_t tlen = tvisstr(o) ? strV(o)->len : STRFMT_MAXBUF_NUM;
273 char *p, *buf; 274 char *p, *buf;
274 do { 275 do {
275 o--; tlen += tvisstr(o) ? strV(o)->len : LJ_STR_NUMBERBUF; 276 o--; tlen += tvisstr(o) ? strV(o)->len : STRFMT_MAXBUF_NUM;
276 } while (--left > 0 && (tvisstr(o-1) || tvisnumber(o-1))); 277 } while (--left > 0 && (tvisstr(o-1) || tvisnumber(o-1)));
277 if (tlen >= LJ_MAX_STR) lj_err_msg(L, LJ_ERR_STROV); 278 if (tlen >= LJ_MAX_STR) lj_err_msg(L, LJ_ERR_STROV);
278 p = buf = lj_buf_tmp(L, (MSize)tlen); 279 p = buf = lj_buf_tmp(L, (MSize)tlen);
@@ -282,10 +283,10 @@ TValue *lj_meta_cat(lua_State *L, TValue *top, int left)
282 MSize len = s->len; 283 MSize len = s->len;
283 p = lj_buf_wmem(p, strdata(s), len); 284 p = lj_buf_wmem(p, strdata(s), len);
284 } else if (tvisint(o)) { 285 } else if (tvisint(o)) {
285 p = lj_str_bufint(p, intV(o)); 286 p = lj_strfmt_wint(p, intV(o));
286 } else { 287 } else {
287 lua_assert(tvisnum(o)); 288 lua_assert(tvisnum(o));
288 p = lj_str_bufnum(p, o); 289 p = lj_strfmt_wnum(p, o);
289 } 290 }
290 } 291 }
291 setstrV(L, top, lj_str_new(L, buf, (size_t)(p-buf))); 292 setstrV(L, top, lj_str_new(L, buf, (size_t)(p-buf)));