aboutsummaryrefslogtreecommitdiff
path: root/loadlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-07-15 14:40:27 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-07-15 14:40:27 -0300
commit60b6599e8322dd93e3b33c9496ff035a1c45552f (patch)
treeeb0d9ffd85b1062aea36fa5b82e714931e718082 /loadlib.c
parentc612685d4b9ecdf0525b4d4410efa9f70d4b4518 (diff)
downloadlua-60b6599e8322dd93e3b33c9496ff035a1c45552f.tar.gz
lua-60b6599e8322dd93e3b33c9496ff035a1c45552f.tar.bz2
lua-60b6599e8322dd93e3b33c9496ff035a1c45552f.zip
Short strings can be external, too
That complicates a little object equality (and therefore table access for long strings), but the old behavior was somewhat weird. (Short strings, a concept otherwise absent from the manual, could not be external.)
Diffstat (limited to 'loadlib.c')
-rw-r--r--loadlib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/loadlib.c b/loadlib.c
index 2cd95ca3..8d2e68e2 100644
--- a/loadlib.c
+++ b/loadlib.c
@@ -345,8 +345,8 @@ static void *freelib (void *ud, void *ptr, size_t osize, size_t nsize) {
345** Create a library string that, when deallocated, will unload 'plib' 345** Create a library string that, when deallocated, will unload 'plib'
346*/ 346*/
347static void createlibstr (lua_State *L, void *plib) { 347static void createlibstr (lua_State *L, void *plib) {
348 static const char dummy[] = /* common long body for all library strings */ 348 /* common content for all library strings */
349 "01234567890123456789012345678901234567890123456789"; 349 static const char dummy[] = "01234567890";
350 lua_pushexternalstring(L, dummy, sizeof(dummy) - 1, freelib, plib); 350 lua_pushexternalstring(L, dummy, sizeof(dummy) - 1, freelib, plib);
351} 351}
352 352