]> granicus.if.org Git - postgresql/commitdiff
Fix unportable usage of <ctype.h> functions.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 6 Mar 2016 23:23:53 +0000 (18:23 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 6 Mar 2016 23:23:53 +0000 (18:23 -0500)
isdigit(), isspace(), etc are likely to give surprising results if passed a
signed char.  We should always cast the argument to unsigned char to avoid
that.  Error in commit d78a7d9c7fa3e9cd, found by buildfarm member gaur.

src/backend/tsearch/spell.c

index be3432693df0f588cece1b3ffb5b0858d01c9a10..7c24c47495742e499063099776a50d7c955182d7 100644 (file)
@@ -363,7 +363,7 @@ DecodeFlag(IspellDict *Conf, char *sflag, char **sflagnext)
                                                                         errmsg("non-ASCII affix flag \"%s\"",
                                                                                        sflag)));
                                                }
-                                               else if (isdigit(*next))
+                                               else if (isdigit((unsigned char) *next))
                                                {
                                                        if (!met_comma)
                                                                ereport(ERROR,
@@ -381,7 +381,7 @@ DecodeFlag(IspellDict *Conf, char *sflag, char **sflagnext)
                                                                                                sflag)));
                                                        met_comma = true;
                                                }
-                                               else if (!isspace(*next))
+                                               else if (!isspace((unsigned char) *next))
                                                {
                                                        ereport(ERROR,
                                                                        (errcode(ERRCODE_CONFIG_FILE_ERROR),