From 33c3877ab93949c23ed9a200757685f2f380ea48 Mon Sep 17 00:00:00 2001 From: Martin Nilsson <nilsson@opera.com> Date: Thu, 4 Sep 2014 01:19:20 +0200 Subject: [PATCH] strcoll is C89 and 4.3BSD, so assume it exists. --- src/acconfig.h | 3 --- src/configure.in | 15 --------------- src/stralloc.c | 18 +++--------------- 3 files changed, 3 insertions(+), 33 deletions(-) diff --git a/src/acconfig.h b/src/acconfig.h index e2a924e152..f3ae6b63ec 100644 --- a/src/acconfig.h +++ b/src/acconfig.h @@ -301,9 +301,6 @@ /* Define if you have gethostname */ #undef HAVE_GETHOSTNAME -/* Define if you have strcoll */ -#undef HAVE_STRCOLL - /* Define this if you have dlopen */ #undef HAVE_DLOPEN diff --git a/src/configure.in b/src/configure.in index 422689804b..134820b023 100644 --- a/src/configure.in +++ b/src/configure.in @@ -5747,21 +5747,6 @@ MY_CHECK_FUNCTION(gethostname, char *x=gethostname(buffer,sizeof(buffer)); exit(0); ]) -############################################################################# -MY_CHECK_FUNCTION(strcoll, -[ -#include <string.h> -#include <locale.h> -], [ - setlocale(LC_CTYPE, "ISO-8859-1"); - exit(strcoll("abc", "def") >= 0 || - strcoll("ABC", "DEF") >= 0 || - strcoll("ABC", "ABCD") >= 0 || - strcoll("ABCD", "ABC") <= 0 || - strcoll("*^#", "*^#") != 0 || - strcoll("123", "456") >= 0); -]) - ######################################################################## AC_MSG_CHECKING(if we can declare environ) diff --git a/src/stralloc.c b/src/stralloc.c index 86ed83889c..96a198aef6 100644 --- a/src/stralloc.c +++ b/src/stralloc.c @@ -1580,15 +1580,6 @@ PMOD_EXPORT int c_compare_string(struct pike_string *s, char *foo, int len) return s->len == len && s->size_shift == 0 && !memcmp(s->str,foo,len); } -#ifndef HAVE_STRCOLL -/* No locale function available */ -static int low_binary_strcmp(char *a, ptrdiff_t alen, - char *b, ptrdiff_t blen) -{ - low_quick_binary_strcmp(a,alen,b,blen); -} -#else - /* takes locale into account */ static int low_binary_strcmp(char *a, ptrdiff_t alen, char *b, ptrdiff_t blen) @@ -1608,10 +1599,8 @@ static int low_binary_strcmp(char *a, ptrdiff_t alen, if(alen > blen) return 1; return -1; } -#endif /* Does not take locale into account */ - PMOD_EXPORT ptrdiff_t my_quick_strcmp(struct pike_string *a, struct pike_string *b) { @@ -1639,7 +1628,6 @@ PMOD_EXPORT ptrdiff_t my_strcmp(struct pike_string *a,struct pike_string *b) INT32 ac=index_shared_string(a,e); INT32 bc=index_shared_string(b,e); -#ifdef HAVE_STRCOLL if(ac < 256 && bc < 256) { char atmp[2],btmp[2]; @@ -1650,9 +1638,9 @@ PMOD_EXPORT ptrdiff_t my_strcmp(struct pike_string *a,struct pike_string *b) btmp[1]=0; if((tmp=strcoll(atmp,btmp))) return tmp; - }else -#endif - if(ac-bc) return ac-bc; + } + else if(ac-bc) + return ac-bc; } return a->len - b->len; } -- GitLab