aboutsummaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/lvm.c b/lvm.c
index 3b17a0ad..5df99658 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 1.184 2001/06/11 14:56:42 roberto Exp roberto $ 2** $Id: lvm.c,v 1.185 2001/06/15 19:17:17 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -249,9 +249,9 @@ static void call_arith (lua_State *L, StkId p1, TObject *p2,
249 249
250static int luaV_strlessthan (const TString *ls, const TString *rs) { 250static int luaV_strlessthan (const TString *ls, const TString *rs) {
251 const l_char *l = getstr(ls); 251 const l_char *l = getstr(ls);
252 size_t ll = ls->len; 252 size_t ll = ls->tsv.len;
253 const l_char *r = getstr(rs); 253 const l_char *r = getstr(rs);
254 size_t lr = rs->len; 254 size_t lr = rs->tsv.len;
255 for (;;) { 255 for (;;) {
256 int temp = strcoll(l, r); 256 int temp = strcoll(l, r);
257 if (temp != 0) return (temp < 0); 257 if (temp != 0) return (temp < 0);
@@ -289,20 +289,21 @@ void luaV_strconc (lua_State *L, int total, StkId top) {
289 if (tostring(L, top-2) || tostring(L, top-1)) { 289 if (tostring(L, top-2) || tostring(L, top-1)) {
290 if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) 290 if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT))
291 luaG_concaterror(L, top-2, top-1); 291 luaG_concaterror(L, top-2, top-1);
292 } else if (tsvalue(top-1)->len > 0) { /* if len=0, do nothing */ 292 } else if (tsvalue(top-1)->tsv.len > 0) { /* if len=0, do nothing */
293 /* at least two string values; get as many as possible */ 293 /* at least two string values; get as many as possible */
294 lu_mem tl = (lu_mem)tsvalue(top-1)->len + (lu_mem)tsvalue(top-2)->len; 294 lu_mem tl = (lu_mem)tsvalue(top-1)->tsv.len +
295 (lu_mem)tsvalue(top-2)->tsv.len;
295 l_char *buffer; 296 l_char *buffer;
296 int i; 297 int i;
297 while (n < total && !tostring(L, top-n-1)) { /* collect total length */ 298 while (n < total && !tostring(L, top-n-1)) { /* collect total length */
298 tl += tsvalue(top-n-1)->len; 299 tl += tsvalue(top-n-1)->tsv.len;
299 n++; 300 n++;
300 } 301 }
301 if (tl > MAX_SIZET) luaD_error(L, l_s("string size overflow")); 302 if (tl > MAX_SIZET) luaD_error(L, l_s("string size overflow"));
302 buffer = luaO_openspace(L, tl, l_char); 303 buffer = luaO_openspace(L, tl, l_char);
303 tl = 0; 304 tl = 0;
304 for (i=n; i>0; i--) { /* concat all strings */ 305 for (i=n; i>0; i--) { /* concat all strings */
305 size_t l = tsvalue(top-i)->len; 306 size_t l = tsvalue(top-i)->tsv.len;
306 memcpy(buffer+tl, svalue(top-i), l); 307 memcpy(buffer+tl, svalue(top-i), l);
307 tl += l; 308 tl += l;
308 } 309 }