From: Rhys Weatherley Date: Sat, 8 May 2004 01:10:22 +0000 (+0000) Subject: Remove the locale-sensitive string comparison routines because X-Git-Tag: r.0.0.2~27 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=9d1f7253ac91826318f11fc2dca37c3b8740fba4;p=francis%2Flibjit.git Remove the locale-sensitive string comparison routines because they aren't used in libjit, and front ends will normally have their own functions for this purpose. --- diff --git a/ChangeLog b/ChangeLog index 20a02ff..11976bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,11 @@ jit/jit-rules-interp.c: add "_jit_cache_get_end_method", to allow the end of a method's code to be located without explicit marking. + * configure.in, include/jit/jit-util.h, jit/jit-string.c: + remove the locale-sensitive string comparison routines because + they aren't used in libjit, and front ends will normally have + their own functions for this purpose. + 2004-05-07 Rhys Weatherley * dpas/dpas-function.c, dpas/dpas-internal.h, dpas/dpas-main.c, diff --git a/configure.in b/configure.in index c16067d..637b654 100644 --- a/configure.in +++ b/configure.in @@ -350,8 +350,6 @@ fi AC_FUNC_MEMCMP AC_CHECK_FUNCS(memset memcmp memchr memcpy memmove bcopy bzero bcmp) AC_CHECK_FUNCS(strlen strcpy strcat strncpy strcmp strncmp) -AC_CHECK_FUNCS(strcoll _strcoll stricoll _stricoll strcasecmp) -AC_CHECK_FUNCS(strncoll _strncoll strnicoll _strnicoll strncasecmp) AC_CHECK_FUNCS(strchr strrchr vsprintf vsnprintf _vsnprintf getpagesize) AC_CHECK_FUNCS(isnan isinf finite fmod remainder drem ceil floor) AC_CHECK_FUNCS(acos asin atan atan2 cos cosh exp log log10 pow) diff --git a/include/jit/jit-util.h b/include/jit/jit-util.h index 0a44272..3c8894e 100644 --- a/include/jit/jit-util.h +++ b/include/jit/jit-util.h @@ -51,8 +51,7 @@ int jit_memcmp(const void *s1, const void *s2, unsigned int len) JIT_NOTHROW; void *jit_memchr(const void *str, int ch, unsigned int len) JIT_NOTHROW; /* - * String routines. Note: jit_stricmp uses fixed ASCII rules for case - * comparison, whereas jit_stricoll uses localized rules. + * String routines. */ unsigned int jit_strlen(const char *str) JIT_NOTHROW; char *jit_strcpy(char *dest, const char *src) JIT_NOTHROW; @@ -66,12 +65,6 @@ int jit_strncmp int jit_stricmp(const char *str1, const char *str2) JIT_NOTHROW; int jit_strnicmp (const char *str1, const char *str2, unsigned int len) JIT_NOTHROW; -int jit_strcoll(const char *str1, const char *str2) JIT_NOTHROW; -int jit_strncoll - (const char *str1, const char *str2, unsigned int len) JIT_NOTHROW; -int jit_stricoll(const char *str1, const char *str2) JIT_NOTHROW; -int jit_strnicoll - (const char *str1, const char *str2, unsigned int len) JIT_NOTHROW; char *jit_strchr(const char *str, int ch) JIT_NOTHROW; char *jit_strrchr(const char *str, int ch) JIT_NOTHROW; int jit_sprintf(char *str, const char *format, ...) JIT_NOTHROW; diff --git a/jit/jit-string.c b/jit/jit-string.c index bdc18af..ca77f1c 100644 --- a/jit/jit-string.c +++ b/jit/jit-string.c @@ -239,8 +239,12 @@ int jit_strncmp(const char *str1, const char *str2, unsigned int len) * lower case counterparts before comparison. * * Note: this function is guaranteed to use English case comparison rules, - * no matter what the current locale is set to. Use @code{jit_stricoll} for - * locale-sensitive string comparison. + * no matter what the current locale is set to, making it suitable for + * comparing token tags and simple programming language identifiers. + * + * Locale-sensitive string comparison is complicated and usually specific + * to the front end language or its supporting runtime library. We + * deliberately chose not to handle this in @code{libjit}. * @end deftypefun @*/ int jit_stricmp(const char *str1, const char *str2) @@ -273,10 +277,6 @@ int jit_stricmp(const char *str1, const char *str2) * At most @code{len} characters are compared. Instances of the English * letters A to Z are converted into their lower case counterparts * before comparison. - * - * Note: this function is guaranteed to use English case comparison rules, - * no matter what the current locale is set to. Use @code{jit_strnicoll} for - * locale-sensitive string comparison. * @end deftypefun @*/ int jit_strnicmp(const char *str1, const char *str2, unsigned int len) @@ -303,93 +303,6 @@ int jit_strnicmp(const char *str1, const char *str2, unsigned int len) return 0; } -/*@ - * @deftypefun int jit_strcoll ({const char *} str1, {const char *} str2) - * Compare the two strings @code{str1} and @code{str2}, returning - * a negative, zero, or positive value depending upon their relationship. - * This function uses locale-sensitive comparison rules, but case is - * still considered significant. If the system does not have locale - * sensitive comparisons, this function will be identical to - * @code{jit_strcmp}. - * @end deftypefun -@*/ -int jit_strcoll(const char *str1, const char *str2) -{ -#if defined(HAVE_STRCOLL) - return strcoll(str1, str2); -#elif defined(HAVE__STRCOLL) - return _strcoll(str1, str2); -#elif defined(HAVE_STRCMP) - return strcmp(str1, str2); -#else - return jit_strcmp(str1, str2); -#endif -} - -/*@ - * @deftypefun int jit_stricoll ({const char *} str1, {const char *} str2) - * Compare the two strings @code{str1} and @code{str2}, returning - * a negative, zero, or positive value depending upon their relationship. - * This function uses locale-sensitive comparison rules, while ignoring - * case. If the system does not have locale sensitive comparisons, this - * function will be identical to @code{jit_stricmp}. - * @end deftypefun -@*/ -int jit_stricoll(const char *str1, const char *str2) -{ -#if defined(HAVE_STRICOLL) - return stricoll(str1, str2); -#elif defined(HAVE__STRICOLL) - return _stricoll(str1, str2); -#elif defined(HAVE_STRCASECMP) - return strcasecmp(str1, str2); -#else - return jit_stricmp(str1, str2); -#endif -} - -/*@ - * @deftypefun int jit_strncoll ({const char *} str1, {const char *} str2, {unsigned int} len) - * Compare the two strings @code{str1} and @code{str2}, returning - * a negative, zero, or positive value depending upon their relationship. - * At most @code{len} characters are compared, but it is otherwise - * the same as @code{jit_strcoll}. - * @end deftypefun -@*/ -int jit_strncoll(const char *str1, const char *str2, unsigned int len) -{ -#if defined(HAVE_STRNCOLL) - return strncoll(str1, str2, len); -#elif defined(HAVE__STRNCOLL) - return _strncoll(str1, str2, len); -#elif defined(HAVE_STRNCMP) - return strncmp(str1, str2, len); -#else - return jit_strncmp(str1, str2, len); -#endif -} - -/*@ - * @deftypefun int jit_strnicoll ({const char *} str1, {const char *} str2, {unsigned int} len) - * Compare the two strings @code{str1} and @code{str2}, returning - * a negative, zero, or positive value depending upon their relationship. - * At most @code{len} characters are compared, but it is otherwise - * the same as @code{jit_stricoll}. - * @end deftypefun -@*/ -int jit_strnicoll(const char *str1, const char *str2, unsigned int len) -{ -#if defined(HAVE_STRNICOLL) - return strincoll(str1, str2, len); -#elif defined(HAVE__STRNICOLL) - return _strnicoll(str1, str2, len); -#elif defined(HAVE_STRNCASECMP) - return strncasecmp(str1, str2, len); -#else - return jit_strnicmp(str1, str2, len); -#endif -} - /*@ * @deftypefun {char *} jit_strchr ({const char *} str, int ch) * Search @code{str} for the first occurrence of @code{ch}. Returns