diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-08-30 11:26:16 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-08-30 11:26:16 -0300 |
commit | f33cda8d6eb1cac5b9042429e85f1096175c7ca5 (patch) | |
tree | fc82b6d637628a489bb68fa8ac6f320334170ace /ldebug.c | |
parent | 96f77142374da8a4a7d4e5e8afd559fbaf0430e8 (diff) | |
download | lua-f33cda8d6eb1cac5b9042429e85f1096175c7ca5.tar.gz lua-f33cda8d6eb1cac5b9042429e85f1096175c7ca5.tar.bz2 lua-f33cda8d6eb1cac5b9042429e85f1096175c7ca5.zip |
New macro 'getlstr'
Accesses content and length of a 'TString'.
Diffstat (limited to 'ldebug.c')
-rw-r--r-- | ldebug.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -264,8 +264,7 @@ static void funcinfo (lua_Debug *ar, Closure *cl) { | |||
264 | else { | 264 | else { |
265 | const Proto *p = cl->l.p; | 265 | const Proto *p = cl->l.p; |
266 | if (p->source) { | 266 | if (p->source) { |
267 | ar->source = getstr(p->source); | 267 | ar->source = getlstr(p->source, ar->srclen); |
268 | ar->srclen = tsslen(p->source); | ||
269 | } | 268 | } |
270 | else { | 269 | else { |
271 | ar->source = "=?"; | 270 | ar->source = "=?"; |
@@ -797,8 +796,11 @@ l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { | |||
797 | const char *luaG_addinfo (lua_State *L, const char *msg, TString *src, | 796 | const char *luaG_addinfo (lua_State *L, const char *msg, TString *src, |
798 | int line) { | 797 | int line) { |
799 | char buff[LUA_IDSIZE]; | 798 | char buff[LUA_IDSIZE]; |
800 | if (src) | 799 | if (src) { |
801 | luaO_chunkid(buff, getstr(src), tsslen(src)); | 800 | size_t idlen; |
801 | const char *id = getlstr(src, idlen); | ||
802 | luaO_chunkid(buff, id, idlen); | ||
803 | } | ||
802 | else { /* no source available; use "?" instead */ | 804 | else { /* no source available; use "?" instead */ |
803 | buff[0] = '?'; buff[1] = '\0'; | 805 | buff[0] = '?'; buff[1] = '\0'; |
804 | } | 806 | } |