From f791bb69061c15f73395c5a95958ac18af5ef764 Mon Sep 17 00:00:00 2001 From: Roberto I Date: Fri, 31 Oct 2025 14:48:55 -0300 Subject: Details - New macro l_strcoll to ease changing 'strcoll' to something else. - MAXINDEXRK==1 in 'ltests.h' is enough to run test 'code.lua'. - Removed unused '#include' in 'lutf8lib.c'. --- ltests.h | 7 +------ lutf8lib.c | 1 - lvm.c | 10 +++++++++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ltests.h b/ltests.h index 26ffed83..93096da8 100644 --- a/ltests.h +++ b/ltests.h @@ -142,12 +142,7 @@ LUA_API void *debug_realloc (void *ud, void *block, #define STRCACHE_N 23 #define STRCACHE_M 5 - -/* -** This one is not compatible with tests for opcode optimizations, -** as it blocks some optimizations -#define MAXINDEXRK 0 -*/ +#define MAXINDEXRK 1 /* diff --git a/lutf8lib.c b/lutf8lib.c index df49c901..b7f3fe1e 100644 --- a/lutf8lib.c +++ b/lutf8lib.c @@ -10,7 +10,6 @@ #include "lprefix.h" -#include #include #include #include diff --git a/lvm.c b/lvm.c index 3ce7e87f..efb0db28 100644 --- a/lvm.c +++ b/lvm.c @@ -372,6 +372,14 @@ void luaV_finishset (lua_State *L, const TValue *t, TValue *key, } +/* +** Function to be used for 0-terminated string order comparison +*/ +#if !defined(l_strcoll) +#define l_strcoll strcoll +#endif + + /* ** Compare two strings 'ts1' x 'ts2', returning an integer less-equal- ** -greater than zero if 'ts1' is less-equal-greater than 'ts2'. @@ -386,7 +394,7 @@ static int l_strcmp (const TString *ts1, const TString *ts2) { size_t rl2; const char *s2 = getlstr(ts2, rl2); for (;;) { /* for each segment */ - int temp = strcoll(s1, s2); + int temp = l_strcoll(s1, s2); if (temp != 0) /* not equal? */ return temp; /* done */ else { /* strings are equal up to a '\0' */ -- cgit v1.2.3-55-g6feb