powerpc: Add the lock elision using HTM
[platform/upstream/glibc.git] / localedata / tst-ctype.c
index 470b1ce..62fb11f 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* Copyright (C) 2000-2015 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 2000.
 
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #include <ctype.h>
 #include <locale.h>
+#include <langinfo.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -61,8 +61,8 @@ static struct classes
   }
 
 
-int
-main (void)
+static int
+do_test (void)
 {
   const char *cp;
   const char *cp2;
@@ -71,13 +71,16 @@ main (void)
   size_t inplinelen = 0;
   char *resline = NULL;
   size_t reslinelen = 0;
-  int n;
+  size_t n;
+  const unsigned short int *__ctype_b;
 
   setlocale (LC_ALL, "");
 
   printf ("Testing the ctype data of the `%s' locale\n",
          setlocale (LC_CTYPE, NULL));
 
+  __ctype_b = ((const unsigned short *) nl_langinfo (_NL_CTYPE_CLASS)) + 128;
+
 #if 0
   /* Just for debugging.  */
 
@@ -341,14 +344,14 @@ punct = %04x  alnum = %04x\n",
          || getline (&resline, &reslinelen, stdin) <= 0)
        break;
 
-      inp = strchr (inpline, '\n');
+      inp = (unsigned char *) strchr (inpline, '\n');
       if (inp != NULL)
        *inp = '\0';
-      resp = strchr (resline, '\n');
+      resp = (unsigned char *) strchr (resline, '\n');
       if (resp != NULL)
        *resp = '\0';
 
-      inp = inpline;
+      inp = (unsigned char *) inpline;
       while (*inp != ' ' && *inp != '\t' && *inp && *inp != '\n'
             && *inp != '\0')
        ++inp;
@@ -367,11 +370,11 @@ punct = %04x  alnum = %04x\n",
        if (strcmp (inpline, classes[n].name) == 0)
          break;
 
-      resp = resline;
+      resp = (unsigned char *) resline;
       while (*resp == ' ' || *resp == '\t')
        ++resp;
 
-      if (strlen (inp) != strlen (resp))
+      if (strlen ((char *) inp) != strlen ((char *) resp))
        {
          printf ("lines \"%.20s\"... and \"%.20s\" have not the same length\n",
                  inp, resp);
@@ -380,7 +383,7 @@ punct = %04x  alnum = %04x\n",
 
       if (n < nclasses)
        {
-         if (strspn (resp, "01") != strlen (resp))
+         if (strspn ((char *) resp, "01") != strlen ((char *) resp))
            {
              printf ("result string \"%s\" malformed\n", resp);
              continue;
@@ -444,3 +447,6 @@ punct = %04x  alnum = %04x\n",
   printf ("  No errors for `%s' locale\n\n\n", setlocale (LC_ALL, NULL));
   return 0;
 }
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"