diff options
Diffstat (limited to 'lvm.c')
| -rw-r--r-- | lvm.c | 9 |
1 files changed, 7 insertions, 2 deletions
| @@ -657,6 +657,11 @@ int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) { | |||
| 657 | #define tostring(L,o) \ | 657 | #define tostring(L,o) \ |
| 658 | (ttisstring(o) || (cvt2str(o) && (luaO_tostring(L, o), 1))) | 658 | (ttisstring(o) || (cvt2str(o) && (luaO_tostring(L, o), 1))) |
| 659 | 659 | ||
| 660 | /* | ||
| 661 | ** Check whether object is a short empty string to optimize concatenation. | ||
| 662 | ** (External strings can be empty too; they will be concatenated like | ||
| 663 | ** non-empty ones.) | ||
| 664 | */ | ||
| 660 | #define isemptystr(o) (ttisshrstring(o) && tsvalue(o)->shrlen == 0) | 665 | #define isemptystr(o) (ttisshrstring(o) && tsvalue(o)->shrlen == 0) |
| 661 | 666 | ||
| 662 | /* copy strings in stack from top - n up to top - 1 to buffer */ | 667 | /* copy strings in stack from top - n up to top - 1 to buffer */ |
| @@ -691,8 +696,8 @@ void luaV_concat (lua_State *L, int total) { | |||
| 691 | setobjs2s(L, top - 2, top - 1); /* result is second op. */ | 696 | setobjs2s(L, top - 2, top - 1); /* result is second op. */ |
| 692 | } | 697 | } |
| 693 | else { | 698 | else { |
| 694 | /* at least two non-empty string values; get as many as possible */ | 699 | /* at least two string values; get as many as possible */ |
| 695 | size_t tl = tsslen(tsvalue(s2v(top - 1))); | 700 | size_t tl = tsslen(tsvalue(s2v(top - 1))); /* total length */ |
| 696 | TString *ts; | 701 | TString *ts; |
| 697 | /* collect total length and number of strings */ | 702 | /* collect total length and number of strings */ |
| 698 | for (n = 1; n < total && tostring(L, s2v(top - n - 1)); n++) { | 703 | for (n = 1; n < total && tostring(L, s2v(top - n - 1)); n++) { |
