aboutsummaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
authorRoberto I <roberto@inf.puc-rio.br>2025-10-31 14:48:55 -0300
committerRoberto I <roberto@inf.puc-rio.br>2025-10-31 14:48:55 -0300
commitf791bb69061c15f73395c5a95958ac18af5ef764 (patch)
treecc3ecee14b9db4c6f91eb2e5979ec01fdaf57882 /lvm.c
parentd342328e5b24c9b3c6c5b33bfcf9f8534210b8e6 (diff)
downloadlua-f791bb69061c15f73395c5a95958ac18af5ef764.tar.gz
lua-f791bb69061c15f73395c5a95958ac18af5ef764.tar.bz2
lua-f791bb69061c15f73395c5a95958ac18af5ef764.zip
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'.
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lvm.c b/lvm.c
index 3ce7e87f..efb0db28 100644
--- a/lvm.c
+++ b/lvm.c
@@ -373,6 +373,14 @@ void luaV_finishset (lua_State *L, const TValue *t, TValue *key,
373 373
374 374
375/* 375/*
376** Function to be used for 0-terminated string order comparison
377*/
378#if !defined(l_strcoll)
379#define l_strcoll strcoll
380#endif
381
382
383/*
376** Compare two strings 'ts1' x 'ts2', returning an integer less-equal- 384** Compare two strings 'ts1' x 'ts2', returning an integer less-equal-
377** -greater than zero if 'ts1' is less-equal-greater than 'ts2'. 385** -greater than zero if 'ts1' is less-equal-greater than 'ts2'.
378** The code is a little tricky because it allows '\0' in the strings 386** The code is a little tricky because it allows '\0' in the strings
@@ -386,7 +394,7 @@ static int l_strcmp (const TString *ts1, const TString *ts2) {
386 size_t rl2; 394 size_t rl2;
387 const char *s2 = getlstr(ts2, rl2); 395 const char *s2 = getlstr(ts2, rl2);
388 for (;;) { /* for each segment */ 396 for (;;) { /* for each segment */
389 int temp = strcoll(s1, s2); 397 int temp = l_strcoll(s1, s2);
390 if (temp != 0) /* not equal? */ 398 if (temp != 0) /* not equal? */
391 return temp; /* done */ 399 return temp; /* done */
392 else { /* strings are equal up to a '\0' */ 400 else { /* strings are equal up to a '\0' */