- 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'.
This commit is contained in:
Roberto I
2025-10-31 14:48:55 -03:00
parent d342328e5b
commit f791bb6906
3 changed files with 10 additions and 8 deletions

View File

@@ -142,12 +142,7 @@ LUA_API void *debug_realloc (void *ud, void *block,
#define STRCACHE_N 23 #define STRCACHE_N 23
#define STRCACHE_M 5 #define STRCACHE_M 5
#define MAXINDEXRK 1
/*
** This one is not compatible with tests for opcode optimizations,
** as it blocks some optimizations
#define MAXINDEXRK 0
*/
/* /*

View File

@@ -10,7 +10,6 @@
#include "lprefix.h" #include "lprefix.h"
#include <assert.h>
#include <limits.h> #include <limits.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

10
lvm.c
View File

@@ -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- ** Compare two strings 'ts1' x 'ts2', returning an integer less-equal-
** -greater than zero if 'ts1' is less-equal-greater than 'ts2'. ** -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; size_t rl2;
const char *s2 = getlstr(ts2, rl2); const char *s2 = getlstr(ts2, rl2);
for (;;) { /* for each segment */ for (;;) { /* for each segment */
int temp = strcoll(s1, s2); int temp = l_strcoll(s1, s2);
if (temp != 0) /* not equal? */ if (temp != 0) /* not equal? */
return temp; /* done */ return temp; /* done */
else { /* strings are equal up to a '\0' */ else { /* strings are equal up to a '\0' */