diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-12-14 11:41:57 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-12-14 11:41:57 -0300 |
commit | 4eda1acafa1a69224b2d4f786cf1ec8f7a4d9ac5 (patch) | |
tree | 474a56c1cbb1b109f945cb3765c6ebc918d35b37 /lundump.c | |
parent | ad73b332240ef5b9bab1517517f63a1425dc7545 (diff) | |
download | lua-4eda1acafa1a69224b2d4f786cf1ec8f7a4d9ac5.tar.gz lua-4eda1acafa1a69224b2d4f786cf1ec8f7a4d9ac5.tar.bz2 lua-4eda1acafa1a69224b2d4f786cf1ec8f7a4d9ac5.zip |
Cleaner protocol between 'lua_dump' and writer function
'lua_dump' signals to the writer function the end of a dump, so that
is has more freedom when using the stack.
Diffstat (limited to 'lundump.c')
-rw-r--r-- | lundump.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -152,7 +152,7 @@ static void loadString (LoadState *S, Proto *p, TString **sl) { | |||
152 | luaH_getint(S->h, idx, &stv); | 152 | luaH_getint(S->h, idx, &stv); |
153 | *sl = ts = tsvalue(&stv); | 153 | *sl = ts = tsvalue(&stv); |
154 | luaC_objbarrier(L, p, ts); | 154 | luaC_objbarrier(L, p, ts); |
155 | return; | 155 | return; /* do not save it again */ |
156 | } | 156 | } |
157 | else if ((size -= 2) <= LUAI_MAXSHORTLEN) { /* short string? */ | 157 | else if ((size -= 2) <= LUAI_MAXSHORTLEN) { /* short string? */ |
158 | char buff[LUAI_MAXSHORTLEN + 1]; /* extra space for '\0' */ | 158 | char buff[LUAI_MAXSHORTLEN + 1]; /* extra space for '\0' */ |
@@ -168,10 +168,10 @@ static void loadString (LoadState *S, Proto *p, TString **sl) { | |||
168 | else { /* create internal copy */ | 168 | else { /* create internal copy */ |
169 | *sl = ts = luaS_createlngstrobj(L, size); /* create string */ | 169 | *sl = ts = luaS_createlngstrobj(L, size); /* create string */ |
170 | luaC_objbarrier(L, p, ts); | 170 | luaC_objbarrier(L, p, ts); |
171 | loadVector(S, getlngstr(ts), size); /* load directly in final place */ | 171 | loadVector(S, getlngstr(ts), size + 1); /* load directly in final place */ |
172 | loadByte(S); /* skip ending '\0' */ | ||
173 | } | 172 | } |
174 | S->nstr++; /* add string to list of saved strings */ | 173 | /* add string to list of saved strings */ |
174 | S->nstr++; | ||
175 | setsvalue(L, &sv, ts); | 175 | setsvalue(L, &sv, ts); |
176 | luaH_setint(L, S->h, S->nstr, &sv); | 176 | luaH_setint(L, S->h, S->nstr, &sv); |
177 | luaC_objbarrierback(L, obj2gco(S->h), ts); | 177 | luaC_objbarrierback(L, obj2gco(S->h), ts); |