From f33cda8d6eb1cac5b9042429e85f1096175c7ca5 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 30 Aug 2023 11:26:16 -0300 Subject: New macro 'getlstr' Accesses content and length of a 'TString'. --- ldebug.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ldebug.c') diff --git a/ldebug.c b/ldebug.c index 1b789520..504459a6 100644 --- a/ldebug.c +++ b/ldebug.c @@ -264,8 +264,7 @@ static void funcinfo (lua_Debug *ar, Closure *cl) { else { const Proto *p = cl->l.p; if (p->source) { - ar->source = getstr(p->source); - ar->srclen = tsslen(p->source); + ar->source = getlstr(p->source, ar->srclen); } else { ar->source = "=?"; @@ -797,8 +796,11 @@ l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { const char *luaG_addinfo (lua_State *L, const char *msg, TString *src, int line) { char buff[LUA_IDSIZE]; - if (src) - luaO_chunkid(buff, getstr(src), tsslen(src)); + if (src) { + size_t idlen; + const char *id = getlstr(src, idlen); + luaO_chunkid(buff, id, idlen); + } else { /* no source available; use "?" instead */ buff[0] = '?'; buff[1] = '\0'; } -- cgit v1.2.3-55-g6feb