aboutsummaryrefslogtreecommitdiff
path: root/ldebug.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-08-17 15:59:28 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-08-17 15:59:28 -0300
commit9b4f39ab14fb2e55345c3d23537d129dac23b091 (patch)
treec7e11448e4d6eb1fec6e0a6d58544f17b1a39e10 /ldebug.c
parentf4211a5ea4e235ccfa8b8dfa46031c23e9e839e2 (diff)
downloadlua-9b4f39ab14fb2e55345c3d23537d129dac23b091.tar.gz
lua-9b4f39ab14fb2e55345c3d23537d129dac23b091.tar.bz2
lua-9b4f39ab14fb2e55345c3d23537d129dac23b091.zip
More disciplined use of 'getstr' and 'tsslen'
We may want to add other string variants in the future; this change documents better where the code may need to handle those variants.
Diffstat (limited to 'ldebug.c')
-rw-r--r--ldebug.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ldebug.c b/ldebug.c
index 195d02f8..690ac38f 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -426,7 +426,7 @@ static const char *getobjname (const Proto *p, int lastpc, int reg,
426*/ 426*/
427static void kname (const Proto *p, int c, const char **name) { 427static void kname (const Proto *p, int c, const char **name) {
428 TValue *kvalue = &p->k[c]; 428 TValue *kvalue = &p->k[c];
429 *name = (ttisstring(kvalue)) ? svalue(kvalue) : "?"; 429 *name = (ttisstring(kvalue)) ? getstr(tsvalue(kvalue)) : "?";
430} 430}
431 431
432 432
@@ -569,7 +569,7 @@ static const char *getobjname (const Proto *p, int lastpc, int reg,
569 int b = (op == OP_LOADK) ? GETARG_Bx(i) 569 int b = (op == OP_LOADK) ? GETARG_Bx(i)
570 : GETARG_Ax(p->code[pc + 1]); 570 : GETARG_Ax(p->code[pc + 1]);
571 if (ttisstring(&p->k[b])) { 571 if (ttisstring(&p->k[b])) {
572 *name = svalue(&p->k[b]); 572 *name = getstr(tsvalue(&p->k[b]));
573 return "constant"; 573 return "constant";
574 } 574 }
575 break; 575 break;
@@ -627,7 +627,7 @@ static const char *funcnamefromcode (lua_State *L, const Proto *p,
627 default: 627 default:
628 return NULL; /* cannot find a reasonable name */ 628 return NULL; /* cannot find a reasonable name */
629 } 629 }
630 *name = getstr(G(L)->tmname[tm]) + 2; 630 *name = getshrstr(G(L)->tmname[tm]) + 2;
631 return "metamethod"; 631 return "metamethod";
632} 632}
633 633