diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-08-17 15:59:28 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-08-17 15:59:28 -0300 |
| commit | 9b4f39ab14fb2e55345c3d23537d129dac23b091 (patch) | |
| tree | c7e11448e4d6eb1fec6e0a6d58544f17b1a39e10 /ldebug.c | |
| parent | f4211a5ea4e235ccfa8b8dfa46031c23e9e839e2 (diff) | |
| download | lua-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.c | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -426,7 +426,7 @@ static const char *getobjname (const Proto *p, int lastpc, int reg, | |||
| 426 | */ | 426 | */ |
| 427 | static void kname (const Proto *p, int c, const char **name) { | 427 | static 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 | ||
