diff options
Diffstat (limited to 'src/lib_base.c')
-rw-r--r-- | src/lib_base.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/lib_base.c b/src/lib_base.c index 070970ed..8fecddea 100644 --- a/src/lib_base.c +++ b/src/lib_base.c | |||
@@ -506,21 +506,13 @@ LJLIB_CF(print) | |||
506 | } | 506 | } |
507 | shortcut = (tvisfunc(tv) && funcV(tv)->c.ffid == FF_tostring); | 507 | shortcut = (tvisfunc(tv) && funcV(tv)->c.ffid == FF_tostring); |
508 | for (i = 0; i < nargs; i++) { | 508 | for (i = 0; i < nargs; i++) { |
509 | cTValue *o = &L->base[i]; | ||
510 | char buf[LJ_STR_NUMBERBUF]; | ||
509 | const char *str; | 511 | const char *str; |
510 | size_t size; | 512 | size_t size; |
511 | cTValue *o = &L->base[i]; | 513 | MSize len; |
512 | if (shortcut && tvisstr(o)) { | 514 | if (shortcut && (str = lj_str_buftv(buf, o, &len)) != NULL) { |
513 | str = strVdata(o); | 515 | size = len; |
514 | size = strV(o)->len; | ||
515 | } else if (shortcut && tvisint(o)) { | ||
516 | char buf[LJ_STR_INTBUF]; | ||
517 | char *p = lj_str_bufint(buf, intV(o)); | ||
518 | size = (size_t)(buf+LJ_STR_INTBUF-p); | ||
519 | str = p; | ||
520 | } else if (shortcut && tvisnum(o)) { | ||
521 | char buf[LJ_STR_NUMBUF]; | ||
522 | size = lj_str_bufnum(buf, o); | ||
523 | str = buf; | ||
524 | } else { | 516 | } else { |
525 | copyTV(L, L->top+1, o); | 517 | copyTV(L, L->top+1, o); |
526 | copyTV(L, L->top, L->top-1); | 518 | copyTV(L, L->top, L->top-1); |