From: Ben Pfaff Date: Wed, 26 Dec 2012 03:09:12 +0000 (-0800) Subject: Use "C" locale comparisons for language constructs. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c99748d153d74b325a50f79bc8e59f1f9521f98;p=pspp Use "C" locale comparisons for language constructs. 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. --- diff --git a/src/data/format.c b/src/data/format.c index 58e16d3075..21162a05ae 100644 --- a/src/data/format.c +++ b/src/data/format.c @@ -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; diff --git a/src/data/psql-reader.c b/src/data/psql-reader.c index 4cbd8409ea..630a720711 100644 --- a/src/data/psql-reader.c +++ b/src/data/psql-reader.c @@ -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 diff --git a/src/language/data-io/placement-parser.c b/src/language/data-io/placement-parser.c index 549ac7501e..55e1b5d501 100644 --- a/src/language/data-io/placement-parser.c +++ b/src/language/data-io/placement-parser.c @@ -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; diff --git a/src/language/expressions/parse.c b/src/language/expressions/parse.c index 24380e2819..7b845a8d36 100644 --- a/src/language/expressions/parse.c +++ b/src/language/expressions/parse.c @@ -39,6 +39,7 @@ #include "libpspp/pool.h" #include "libpspp/str.h" +#include "gl/c-strcase.h" #include "gl/xalloc.h" /* 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 diff --git a/src/language/stats/aggregate.c b/src/language/stats/aggregate.c index ff6c1fb59e..4d95e62e64 100644 --- a/src/language/stats/aggregate.c +++ b/src/language/stats/aggregate.c @@ -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) { diff --git a/src/output/measure.c b/src/output/measure.c index 60894f1cc2..faeef969b0 100644 --- a/src/output/measure.c +++ b/src/output/measure.c @@ -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; }