Use "C" locale comparisons for language constructs.
authorBen Pfaff <blp@cs.stanford.edu>
Wed, 26 Dec 2012 03:09:12 +0000 (19:09 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 28 Dec 2012 03:57:16 +0000 (19:57 -0800)
These language constructs are ASCII so there's no need for a
locale-independent comparison and it seems to me that one would not make
sense in edge cases.

src/data/format.c
src/data/psql-reader.c
src/language/data-io/placement-parser.c
src/language/expressions/parse.c
src/language/stats/aggregate.c
src/output/measure.c

index 58e16d3075a4249080db940efcb1e7dd7285c938..21162a05ae4f4ab21aff8012def2fdcd83d30123 100644 (file)
@@ -33,6 +33,7 @@
 #include "libpspp/misc.h"
 #include "libpspp/str.h"
 
+#include "gl/c-strcase.h"
 #include "gl/minmax.h"
 #include "gl/xalloc.h"
 
@@ -581,7 +582,7 @@ fmt_from_name (const char *name, enum fmt_type *type)
   int i;
 
   for (i = 0; i < FMT_NUMBER_OF_FORMATS; i++)
-    if (!strcasecmp (name, get_fmt_desc (i)->name))
+    if (!c_strcasecmp (name, get_fmt_desc (i)->name))
       {
         *type = i;
         return true;
index 4cbd8409eae549cf6cd1118a001c698e46a88125..630a720711ce14af83784137085cd8cb72f57ab2 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -32,8 +32,9 @@
 #include "libpspp/misc.h"
 #include "libpspp/str.h"
 
-#include "gl/xalloc.h"
+#include "gl/c-strcase.h"
 #include "gl/minmax.h"
+#include "gl/xalloc.h"
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -270,7 +271,7 @@ psql_open_reader (struct psql_read_info *info, struct dictionary **dict)
   {
     const char *dt =  PQparameterStatus (r->conn, "integer_datetimes");
 
-    r->integer_datetimes = ( 0 == strcasecmp (dt, "on"));
+    r->integer_datetimes = ( 0 == c_strcasecmp (dt, "on"));
   }
 
 #if USE_SSL
index 549ac7501e73d3f804d82f97de5c4797d3de612e..55e1b5d501360b6693de79cbdbd5b9349c380ba3 100644 (file)
@@ -27,6 +27,7 @@
 #include "libpspp/pool.h"
 #include "libpspp/str.h"
 
+#include "gl/c-strcase.h"
 #include "gl/xalloc.h"
 #include "gl/xsize.h"
 
@@ -220,9 +221,9 @@ fixed_parse_fortran (struct lexer *lexer, struct pool *pool, enum fmt_use use,
               if (!parse_abstract_format_specifier (lexer, type, &f.w, &f.d))
                 return false;
 
-              if (!strcasecmp (type, "T"))
+              if (!c_strcasecmp (type, "T"))
                 f.type = PRS_TYPE_T;
-              else if (!strcasecmp (type, "X"))
+              else if (!c_strcasecmp (type, "X"))
                 {
                   f.type = PRS_TYPE_X;
                   f.w = count;
index 24380e28192f3c22274522db12db8f5d401ea32a..7b845a8d369ebf6da4b736db7c7028cc1ad9814b 100644 (file)
@@ -39,6 +39,7 @@
 #include "libpspp/pool.h"
 #include "libpspp/str.h"
 
+#include "gl/c-strcase.h"
 #include "gl/xalloc.h"
 \f
 /* Declarations. */
@@ -1006,7 +1007,7 @@ compare_names (const char *test, const char *name, bool abbrev_ok)
 static int
 compare_strings (const char *test, const char *name, bool abbrev_ok UNUSED)
 {
-  return strcasecmp (test, name);
+  return c_strcasecmp (test, name);
 }
 
 static bool
index ff6c1fb59e8434a9ae475186a6d48d3e11369587..4d95e62e64f6ea098bad20b7e181927a6a0271a2 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 1997-9, 2000, 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1997-9, 2000, 2006, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -49,6 +49,7 @@
 #include "math/sort.h"
 #include "math/statistic.h"
 
+#include "gl/c-strcase.h"
 #include "gl/minmax.h"
 #include "gl/xalloc.h"
 
@@ -452,7 +453,7 @@ parse_aggregate_functions (struct lexer *lexer, const struct dictionary *dict,
       exclude = ds_chomp_byte (&function_name, '.') ? MV_SYSTEM : MV_ANY;
 
       for (function = agr_func_tab; function->name; function++)
-       if (!strcasecmp (function->name, ds_cstr (&function_name)))
+       if (!c_strcasecmp (function->name, ds_cstr (&function_name)))
          break;
       if (NULL == function->name)
        {
index 60894f1cc25f81b3b21ae862ee646e0ac1d3c0ac..faeef969b09b247e4b4d3a7f468e35a2039bccbe 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 1997-9, 2000, 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 1997-9, 2000, 2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@
 #include "data/file-name.h"
 #include "libpspp/str.h"
 
+#include "gl/c-strcase.h"
 #include "gl/error.h"
 
 #include "gettext.h"
@@ -135,7 +136,7 @@ parse_unit (const char *unit)
 
   unit += strspn (unit, CC_SPACES);
   for (p = units; p < units + sizeof units / sizeof *units; p++)
-    if (!strcasecmp (unit, p->name))
+    if (!c_strcasecmp (unit, p->name))
       return p->factor;
   return 0.0;
 }