diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-02-26 11:29:54 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-02-26 11:29:54 -0300 |
commit | ceac82f78be8baeddfa8536472d8b08df2eb7d49 (patch) | |
tree | 033247e2a23b2c3fd832101ba3fc8a73c3313127 /lobject.c | |
parent | e5f4927a0b97015d4c22bc22fbf80fb2c11ca7cc (diff) | |
download | lua-ceac82f78be8baeddfa8536472d8b08df2eb7d49.tar.gz lua-ceac82f78be8baeddfa8536472d8b08df2eb7d49.tar.bz2 lua-ceac82f78be8baeddfa8536472d8b08df2eb7d49.zip |
Details
Comments, small changes in the manual, an extra test for errors in
error handling, small changes in tests.
Diffstat (limited to 'lobject.c')
-rw-r--r-- | lobject.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -247,7 +247,7 @@ static lua_Number lua_strx2number (const char *s, char **endptr) { | |||
247 | nosigdig++; | 247 | nosigdig++; |
248 | else if (++sigdig <= MAXSIGDIG) /* can read it without overflow? */ | 248 | else if (++sigdig <= MAXSIGDIG) /* can read it without overflow? */ |
249 | r = (r * l_mathop(16.0)) + luaO_hexavalue(*s); | 249 | r = (r * l_mathop(16.0)) + luaO_hexavalue(*s); |
250 | else e++; /* too many digits; ignore, but still count for exponent */ | 250 | else e++; /* too many digits; ignore, but still count for exponent */ |
251 | if (hasdot) e--; /* decimal digit? correct exponent */ | 251 | if (hasdot) e--; /* decimal digit? correct exponent */ |
252 | } | 252 | } |
253 | else break; /* neither a dot nor a digit */ | 253 | else break; /* neither a dot nor a digit */ |
@@ -512,18 +512,18 @@ static void initbuff (lua_State *L, BuffFS *buff) { | |||
512 | static void pushbuff (lua_State *L, void *ud) { | 512 | static void pushbuff (lua_State *L, void *ud) { |
513 | BuffFS *buff = cast(BuffFS*, ud); | 513 | BuffFS *buff = cast(BuffFS*, ud); |
514 | switch (buff->err) { | 514 | switch (buff->err) { |
515 | case 1: | 515 | case 1: /* memory error */ |
516 | luaD_throw(L, LUA_ERRMEM); | 516 | luaD_throw(L, LUA_ERRMEM); |
517 | break; | 517 | break; |
518 | case 2: /* length overflow: Add "..." at the end of result */ | 518 | case 2: /* length overflow: Add "..." at the end of result */ |
519 | if (buff->buffsize - buff->blen < 3) | 519 | if (buff->buffsize - buff->blen < 3) |
520 | strcpy(buff->b + buff->blen - 3, "..."); /* 'blen' must be > 3 */ | 520 | strcpy(buff->b + buff->blen - 3, "..."); /* 'blen' must be > 3 */ |
521 | else { /* there is enough space left for the "..." */ | 521 | else { /* there is enough space left for the "..." */ |
522 | strcpy(buff->b + buff->blen, "..."); | 522 | strcpy(buff->b + buff->blen, "..."); |
523 | buff->blen += 3; | 523 | buff->blen += 3; |
524 | } | 524 | } |
525 | /* FALLTHROUGH */ | 525 | /* FALLTHROUGH */ |
526 | default: { /* no errors */ | 526 | default: { /* no errors, but it can raise one creating the new string */ |
527 | TString *ts = luaS_newlstr(L, buff->b, buff->blen); | 527 | TString *ts = luaS_newlstr(L, buff->b, buff->blen); |
528 | setsvalue2s(L, L->top.p, ts); | 528 | setsvalue2s(L, L->top.p, ts); |
529 | L->top.p++; | 529 | L->top.p++; |