diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-12-11 15:32:43 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-12-11 15:32:43 -0300 |
commit | 412e9a4d952d47631feddfa4ec25a520ec75b103 (patch) | |
tree | 0c687ad50875ead9bc0c07d2e53a3ab58ab17675 | |
parent | 25a491fe349fc52b69ece2ecbcb0b0189decb36f (diff) | |
download | lua-412e9a4d952d47631feddfa4ec25a520ec75b103.tar.gz lua-412e9a4d952d47631feddfa4ec25a520ec75b103.tar.bz2 lua-412e9a4d952d47631feddfa4ec25a520ec75b103.zip |
'luaH_fastseti' uses 'checknoTM'
The extra check in checknoTM (versus only checking whether there is a
metatable) is cheap, and it is not that uncommon for a table to have a
metatable without a __newindex metafield.
-rw-r--r-- | ltable.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -58,7 +58,7 @@ | |||
58 | { Table *h = t; lua_Unsigned u = l_castS2U(k) - 1u; \ | 58 | { Table *h = t; lua_Unsigned u = l_castS2U(k) - 1u; \ |
59 | if ((u < h->asize)) { \ | 59 | if ((u < h->asize)) { \ |
60 | lu_byte *tag = getArrTag(h, u); \ | 60 | lu_byte *tag = getArrTag(h, u); \ |
61 | if (h->metatable == NULL || !tagisempty(*tag)) \ | 61 | if (checknoTM(h->metatable, TM_NEWINDEX) || !tagisempty(*tag)) \ |
62 | { fval2arr(h, u, tag, val); hres = HOK; } \ | 62 | { fval2arr(h, u, tag, val); hres = HOK; } \ |
63 | else hres = ~cast_int(u); } \ | 63 | else hres = ~cast_int(u); } \ |
64 | else { hres = luaH_psetint(h, k, val); }} | 64 | else { hres = luaH_psetint(h, k, val); }} |