diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-03-21 11:23:21 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-03-21 11:23:21 -0300 |
| commit | 0593256707ceddb1bc9cd4b25b822a7fbcfedd66 (patch) | |
| tree | 6c6859b94086b71b27409b565ed34c114f03e7f8 /ldump.c | |
| parent | ce6f5502c99ce9a367e25b678e375db6f8164d73 (diff) | |
| download | lua-0593256707ceddb1bc9cd4b25b822a7fbcfedd66.tar.gz lua-0593256707ceddb1bc9cd4b25b822a7fbcfedd66.tar.bz2 lua-0593256707ceddb1bc9cd4b25b822a7fbcfedd66.zip | |
'luaH_get' functions return tag of the result
Undoing previous commit. Returning TValue increases code size without
any visible gains. Returning the tag is a little simpler than returning
a special code (HOK/HNOTFOUND) and the tag is useful by itself in
some cases.
Diffstat (limited to 'ldump.c')
| -rw-r--r-- | ldump.c | 5 |
1 files changed, 3 insertions, 2 deletions
| @@ -132,8 +132,9 @@ static void dumpString (DumpState *D, TString *ts) { | |||
| 132 | if (ts == NULL) | 132 | if (ts == NULL) |
| 133 | dumpSize(D, 0); | 133 | dumpSize(D, 0); |
| 134 | else { | 134 | else { |
| 135 | TValue idx = luaH_getstr(D->h, ts); | 135 | TValue idx; |
| 136 | if (!isemptyV(idx)) { /* string already saved? */ | 136 | int tag = luaH_getstr(D->h, ts, &idx); |
| 137 | if (!tagisempty(tag)) { /* string already saved? */ | ||
| 137 | dumpSize(D, 1); /* reuse a saved string */ | 138 | dumpSize(D, 1); /* reuse a saved string */ |
| 138 | dumpSize(D, cast_sizet(ivalue(&idx))); /* index of saved string */ | 139 | dumpSize(D, cast_sizet(ivalue(&idx))); /* index of saved string */ |
| 139 | } | 140 | } |
