From 9b4f39ab14fb2e55345c3d23537d129dac23b091 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 17 Aug 2023 15:59:28 -0300 Subject: 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. --- ldebug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ldebug.c') 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, */ static void kname (const Proto *p, int c, const char **name) { TValue *kvalue = &p->k[c]; - *name = (ttisstring(kvalue)) ? svalue(kvalue) : "?"; + *name = (ttisstring(kvalue)) ? getstr(tsvalue(kvalue)) : "?"; } @@ -569,7 +569,7 @@ static const char *getobjname (const Proto *p, int lastpc, int reg, int b = (op == OP_LOADK) ? GETARG_Bx(i) : GETARG_Ax(p->code[pc + 1]); if (ttisstring(&p->k[b])) { - *name = svalue(&p->k[b]); + *name = getstr(tsvalue(&p->k[b])); return "constant"; } break; @@ -627,7 +627,7 @@ static const char *funcnamefromcode (lua_State *L, const Proto *p, default: return NULL; /* cannot find a reasonable name */ } - *name = getstr(G(L)->tmname[tm]) + 2; + *name = getshrstr(G(L)->tmname[tm]) + 2; return "metamethod"; } -- cgit v1.2.3-55-g6feb