Move Locale methods to locale.c source module
authorCristy <urban-warrior@imagemagick.org>
Mon, 19 Oct 2015 18:36:08 +0000 (14:36 -0400)
committerCristy <urban-warrior@imagemagick.org>
Mon, 19 Oct 2015 18:36:08 +0000 (14:36 -0400)
MagickCore/hashmap.c
MagickCore/locale.c
MagickCore/locale_.h
MagickCore/splay-tree.c
MagickCore/string.c
MagickCore/string_.h

index 19e81c8c331be00ede64f4f283bf2283e58cd96c..9f600e0b4b3ed5c69631ad18244e7d1ce519b51f 100644 (file)
@@ -45,6 +45,7 @@
 #include "MagickCore/studio.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
+#include "MagickCore/locale_.h"
 #include "MagickCore/hashmap.h"
 #include "MagickCore/memory_.h"
 #include "MagickCore/semaphore.h"
index a9e9adefd115e3ca7e0bbf29c4c2f842dfaffb19..5dc8c6de6006794ec7fdec0491c6f43703f11e7e 100644 (file)
@@ -1380,6 +1380,204 @@ static MagickBooleanType LoadLocaleCache(SplayTreeInfo *locale_cache,
 %                                                                             %
 %                                                                             %
 %                                                                             %
+%   L o c a l e C o m p a r e                                                 %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  LocaleCompare() performs a case-insensitive comparison of two strings
+%  byte-by-byte, according to the ordering of the current locale encoding.
+%  LocaleCompare returns an integer greater than, equal to, or less than 0,
+%  if the string pointed to by p is greater than, equal to, or less than the
+%  string pointed to by q respectively.  The sign of a non-zero return value
+%  is determined by the sign of the difference between the values of the first
+%  pair of bytes that differ in the strings being compared.
+%
+%  The format of the LocaleCompare method is:
+%
+%      int LocaleCompare(const char *p,const char *q)
+%
+%  A description of each parameter follows:
+%
+%    o p: A pointer to a character string.
+%
+%    o q: A pointer to a character string to compare to p.
+%
+*/
+MagickExport int LocaleCompare(const char *p,const char *q)
+{
+  if ((p == (char *) NULL) && (q == (char *) NULL))
+    return(0);
+  if (p == (char *) NULL)
+    return(-1);
+  if (q == (char *) NULL)
+    return(1);
+#if defined(MAGICKCORE_HAVE_STRCASECMP)
+  return(strcasecmp(p,q));
+#else
+  {
+    register int
+      c,
+      d;
+
+    for ( ; ; )
+    {
+      c=(int) *((unsigned char *) p);
+      d=(int) *((unsigned char *) q);
+      if ((c == 0) || (AsciiMap[c] != AsciiMap[d]))
+        break;
+      p++;
+      q++;
+    }
+    return(AsciiMap[c]-(int) AsciiMap[d]);
+  }
+#endif
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%   L o c a l e L o w e r                                                     %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  LocaleLower() transforms all of the characters in the supplied
+%  null-terminated string, changing all uppercase letters to lowercase.
+%
+%  The format of the LocaleLower method is:
+%
+%      void LocaleLower(char *string)
+%
+%  A description of each parameter follows:
+%
+%    o string: A pointer to the string to convert to lower-case Locale.
+%
+*/
+MagickExport void LocaleLower(char *string)
+{
+  register char
+    *q;
+
+  assert(string != (char *) NULL);
+  for (q=string; *q != '\0'; q++)
+    *q=(char) tolower((int) *q);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%   L o c a l e N C o m p a r e                                               %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  LocaleNCompare() performs a case-insensitive comparison of two strings
+%  byte-by-byte, according to the ordering of the current locale encoding.
+%
+%  LocaleNCompare returns an integer greater than, equal to, or less than 0,
+%  if the string pointed to by p is greater than, equal to, or less than the
+%  string pointed to by q respectively.  The sign of a non-zero return value
+%  is determined by the sign of the difference between the values of the first
+%  pair of bytes that differ in the strings being compared.
+%
+%  The LocaleNCompare method makes the same comparison as LocaleCompare but
+%  looks at a maximum of n bytes.  Bytes following a null byte are not
+%  compared.
+%
+%  The format of the LocaleNCompare method is:
+%
+%      int LocaleNCompare(const char *p,const char *q,const size_t n)
+%
+%  A description of each parameter follows:
+%
+%    o p: A pointer to a character string.
+%
+%    o q: A pointer to a character string to compare to p.
+%
+%    o length: the number of characters to compare in strings p and q.
+%
+*/
+MagickExport int LocaleNCompare(const char *p,const char *q,const size_t length)
+{
+  if ((p == (char *) NULL) && (q == (char *) NULL))
+    return(0);
+  if (p == (char *) NULL)
+    return(-1);
+  if (q == (char *) NULL)
+    return(1);
+#if defined(MAGICKCORE_HAVE_STRNCASECMP)
+  return(strncasecmp(p,q,length));
+#else
+  {
+    register int
+      c,
+      d;
+
+    register size_t
+      i;
+
+    for (i=length; i != 0; i--)
+    {
+      c=(int) *((unsigned char *) p);
+      d=(int) *((unsigned char *) q);
+      if (AsciiMap[c] != AsciiMap[d])
+        return(AsciiMap[c]-(int) AsciiMap[d]);
+      if (c == 0)
+        return(0);
+      p++;
+      q++;
+    }
+    return(0);
+  }
+#endif
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%   L o c a l e U p p e r                                                     %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  LocaleUpper() transforms all of the characters in the supplied
+%  null-terminated string, changing all lowercase letters to uppercase.
+%
+%  The format of the LocaleUpper method is:
+%
+%      void LocaleUpper(char *string)
+%
+%  A description of each parameter follows:
+%
+%    o string: A pointer to the string to convert to upper-case Locale.
+%
+*/
+MagickExport void LocaleUpper(char *string)
+{
+  register char
+    *q;
+
+  assert(string != (char *) NULL);
+  for (q=string; *q != '\0'; q++)
+    *q=(char) toupper((int) *q);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 +   L o c a l e C o m p o n e n t G e n e s i s                               %
 %                                                                             %
 %                                                                             %
index 030cce1a25c6da93bf8ff450ee7d0364b87d8213..ac81dfe68110963f30674b24cc325bbe153933f8 100644 (file)
@@ -51,6 +51,10 @@ extern MagickExport const LocaleInfo
 extern MagickExport double
   InterpretLocaleValue(const char *restrict,char **restrict);
 
+extern MagickExport int
+  LocaleCompare(const char *,const char *),
+  LocaleNCompare(const char *,const char *,const size_t);
+
 extern MagickExport LinkedListInfo
   *DestroyLocaleOptions(LinkedListInfo *),
   *GetLocaleOptions(const char *,ExceptionInfo *);
@@ -64,6 +68,10 @@ extern MagickExport ssize_t
   FormatLocaleString(char *restrict,const size_t,const char *restrict,...)
     magick_attribute((__format__ (__printf__,3,4)));
 
+extern MagickExport void
+  LocaleLower(char *),
+  LocaleUpper(char *);
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif
index fadbc827149091a8fd725f89b1f4a8e5ceaa6153..36d81672023371437b3393f19db56419b954f34b 100644 (file)
@@ -51,6 +51,7 @@
 #include "MagickCore/studio.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
+#include "MagickCore/locale_.h"
 #include "MagickCore/log.h"
 #include "MagickCore/memory_.h"
 #include "MagickCore/splay-tree.h"
index ab19463a907c2e76581d3f0844569e789f2c9009..2b39da9063de74972c0ea556ac6b9fc80e90b166 100755 (executable)
@@ -1513,204 +1513,6 @@ MagickExport MagickBooleanType IsStringFalse(const char *value)
 %                                                                             %
 %                                                                             %
 %                                                                             %
-%   L o c a l e C o m p a r e                                                 %
-%                                                                             %
-%                                                                             %
-%                                                                             %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  LocaleCompare() performs a case-insensitive comparison of two strings
-%  byte-by-byte, according to the ordering of the current locale encoding.
-%  LocaleCompare returns an integer greater than, equal to, or less than 0,
-%  if the string pointed to by p is greater than, equal to, or less than the
-%  string pointed to by q respectively.  The sign of a non-zero return value
-%  is determined by the sign of the difference between the values of the first
-%  pair of bytes that differ in the strings being compared.
-%
-%  The format of the LocaleCompare method is:
-%
-%      int LocaleCompare(const char *p,const char *q)
-%
-%  A description of each parameter follows:
-%
-%    o p: A pointer to a character string.
-%
-%    o q: A pointer to a character string to compare to p.
-%
-*/
-MagickExport int LocaleCompare(const char *p,const char *q)
-{
-  if ((p == (char *) NULL) && (q == (char *) NULL))
-    return(0);
-  if (p == (char *) NULL)
-    return(-1);
-  if (q == (char *) NULL)
-    return(1);
-#if defined(MAGICKCORE_HAVE_STRCASECMP)
-  return(strcasecmp(p,q));
-#else
-  {
-    register int
-      c,
-      d;
-
-    for ( ; ; )
-    {
-      c=(int) *((unsigned char *) p);
-      d=(int) *((unsigned char *) q);
-      if ((c == 0) || (AsciiMap[c] != AsciiMap[d]))
-        break;
-      p++;
-      q++;
-    }
-    return(AsciiMap[c]-(int) AsciiMap[d]);
-  }
-#endif
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                             %
-%                                                                             %
-%                                                                             %
-%   L o c a l e L o w e r                                                     %
-%                                                                             %
-%                                                                             %
-%                                                                             %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  LocaleLower() transforms all of the characters in the supplied
-%  null-terminated string, changing all uppercase letters to lowercase.
-%
-%  The format of the LocaleLower method is:
-%
-%      void LocaleLower(char *string)
-%
-%  A description of each parameter follows:
-%
-%    o string: A pointer to the string to convert to lower-case Locale.
-%
-*/
-MagickExport void LocaleLower(char *string)
-{
-  register char
-    *q;
-
-  assert(string != (char *) NULL);
-  for (q=string; *q != '\0'; q++)
-    *q=(char) tolower((int) *q);
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                             %
-%                                                                             %
-%                                                                             %
-%   L o c a l e N C o m p a r e                                               %
-%                                                                             %
-%                                                                             %
-%                                                                             %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  LocaleNCompare() performs a case-insensitive comparison of two strings
-%  byte-by-byte, according to the ordering of the current locale encoding.
-%
-%  LocaleNCompare returns an integer greater than, equal to, or less than 0,
-%  if the string pointed to by p is greater than, equal to, or less than the
-%  string pointed to by q respectively.  The sign of a non-zero return value
-%  is determined by the sign of the difference between the values of the first
-%  pair of bytes that differ in the strings being compared.
-%
-%  The LocaleNCompare method makes the same comparison as LocaleCompare but
-%  looks at a maximum of n bytes.  Bytes following a null byte are not
-%  compared.
-%
-%  The format of the LocaleNCompare method is:
-%
-%      int LocaleNCompare(const char *p,const char *q,const size_t n)
-%
-%  A description of each parameter follows:
-%
-%    o p: A pointer to a character string.
-%
-%    o q: A pointer to a character string to compare to p.
-%
-%    o length: the number of characters to compare in strings p and q.
-%
-*/
-MagickExport int LocaleNCompare(const char *p,const char *q,const size_t length)
-{
-  if ((p == (char *) NULL) && (q == (char *) NULL))
-    return(0);
-  if (p == (char *) NULL)
-    return(-1);
-  if (q == (char *) NULL)
-    return(1);
-#if defined(MAGICKCORE_HAVE_STRNCASECMP)
-  return(strncasecmp(p,q,length));
-#else
-  {
-    register int
-      c,
-      d;
-
-    register size_t
-      i;
-
-    for (i=length; i != 0; i--)
-    {
-      c=(int) *((unsigned char *) p);
-      d=(int) *((unsigned char *) q);
-      if (AsciiMap[c] != AsciiMap[d])
-        return(AsciiMap[c]-(int) AsciiMap[d]);
-      if (c == 0)
-        return(0);
-      p++;
-      q++;
-    }
-    return(0);
-  }
-#endif
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                             %
-%                                                                             %
-%                                                                             %
-%   L o c a l e U p p e r                                                     %
-%                                                                             %
-%                                                                             %
-%                                                                             %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  LocaleUpper() transforms all of the characters in the supplied
-%  null-terminated string, changing all lowercase letters to uppercase.
-%
-%  The format of the LocaleUpper method is:
-%
-%      void LocaleUpper(char *string)
-%
-%  A description of each parameter follows:
-%
-%    o string: A pointer to the string to convert to upper-case Locale.
-%
-*/
-MagickExport void LocaleUpper(char *string)
-{
-  register char
-    *q;
-
-  assert(string != (char *) NULL);
-  for (q=string; *q != '\0'; q++)
-    *q=(char) toupper((int) *q);
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                             %
-%                                                                             %
-%                                                                             %
 %   P r i n t S t r i n g I n f o                                             %
 %                                                                             %
 %                                                                             %
index 18bc6e5991c07233282ff81eb53398d46346b0b7..337df18971f7afe031c57f6958cb06eac5ea2e2a 100644 (file)
@@ -60,9 +60,7 @@ extern MagickExport double
   *StringToArrayOfDoubles(const char *,ssize_t *,ExceptionInfo *);
 
 extern MagickExport int
-  CompareStringInfo(const StringInfo *,const StringInfo *),
-  LocaleCompare(const char *,const char *),
-  LocaleNCompare(const char *,const char *,const size_t);
+  CompareStringInfo(const StringInfo *,const StringInfo *);
 
 extern MagickExport MagickBooleanType
   ConcatenateString(char **,const char *),
@@ -98,8 +96,6 @@ extern MagickExport unsigned char
 extern MagickExport void
   ConcatenateStringInfo(StringInfo *,const StringInfo *)
     magick_attribute((__nonnull__)),
-  LocaleLower(char *),
-  LocaleUpper(char *),
   PrintStringInfo(FILE *file,const char *,const StringInfo *),
   ResetStringInfo(StringInfo *),
   SetStringInfo(StringInfo *,const StringInfo *),