diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-06-20 13:43:33 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-06-20 13:43:33 -0300 |
commit | 55ac40f859ad8e28fe71a8801d49f4a4140e8aa3 (patch) | |
tree | 1a1f02de45d28c7eb8976087ade773d7937bed14 /lstring.c | |
parent | 97ef8e7bd40340d47a9789beb06f0128d7438d0a (diff) | |
download | lua-55ac40f859ad8e28fe71a8801d49f4a4140e8aa3.tar.gz lua-55ac40f859ad8e28fe71a8801d49f4a4140e8aa3.tar.bz2 lua-55ac40f859ad8e28fe71a8801d49f4a4140e8aa3.zip |
Cleaning of llimits.h
Several definitions that don't need to be "global" (that is, that
concerns only specific parts of the code) moved out of llimits.h,
to more appropriate places.
Diffstat (limited to 'lstring.c')
-rw-r--r-- | lstring.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -25,7 +25,17 @@ | |||
25 | /* | 25 | /* |
26 | ** Maximum size for string table. | 26 | ** Maximum size for string table. |
27 | */ | 27 | */ |
28 | #define MAXSTRTB cast_int(luaM_limitN(MAX_INT, TString*)) | 28 | #define MAXSTRTB cast_int(luaM_limitN(INT_MAX, TString*)) |
29 | |||
30 | /* | ||
31 | ** Initial size for the string table (must be power of 2). | ||
32 | ** The Lua core alone registers ~50 strings (reserved words + | ||
33 | ** metaevent keys + a few others). Libraries would typically add | ||
34 | ** a few dozens more. | ||
35 | */ | ||
36 | #if !defined(MINSTRTABSIZE) | ||
37 | #define MINSTRTABSIZE 128 | ||
38 | #endif | ||
29 | 39 | ||
30 | 40 | ||
31 | /* | 41 | /* |
@@ -188,9 +198,9 @@ void luaS_remove (lua_State *L, TString *ts) { | |||
188 | 198 | ||
189 | 199 | ||
190 | static void growstrtab (lua_State *L, stringtable *tb) { | 200 | static void growstrtab (lua_State *L, stringtable *tb) { |
191 | if (l_unlikely(tb->nuse == MAX_INT)) { /* too many strings? */ | 201 | if (l_unlikely(tb->nuse == INT_MAX)) { /* too many strings? */ |
192 | luaC_fullgc(L, 1); /* try to free some... */ | 202 | luaC_fullgc(L, 1); /* try to free some... */ |
193 | if (tb->nuse == MAX_INT) /* still too many? */ | 203 | if (tb->nuse == INT_MAX) /* still too many? */ |
194 | luaM_error(L); /* cannot even create a message... */ | 204 | luaM_error(L); /* cannot even create a message... */ |
195 | } | 205 | } |
196 | if (tb->size <= MAXSTRTB / 2) /* can grow string table? */ | 206 | if (tb->size <= MAXSTRTB / 2) /* can grow string table? */ |