Hi čt 30. 11. 2023 v 4:40 odesílatel Tom Lane <t...@sss.pgh.pa.us> napsal:
> Daniel Gustafsson <dan...@yesql.se> writes: > > I took another look at this, found some more polish that was needed, > added > > another testcase and ended up pushing it. > > mamba is unhappy because this uses <ctype.h> functions without > casting their arguments to unsigned char: > > > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=mamba&dt=2023-11-30%2002%3A53%3A25 > > (I had not realized that we still had buildfarm animals that would > complain about this ... but I'm glad we do, because it's a hazard. > POSIX is quite clear that the behavior is undefined for signed chars.) > here is a patch Regards Pavel > > regards, tom lane >
commit 29a570f6b003513ef93691d92e01ea80fab11844 Author: ok...@github.com <pavel.steh...@gmail.com> Date: Thu Nov 30 07:10:58 2023 +0100 fix warning array subscript has type 'char' diff --git a/src/bin/pg_dump/filter.c b/src/bin/pg_dump/filter.c index dff871c7cd..d79b6da27c 100644 --- a/src/bin/pg_dump/filter.c +++ b/src/bin/pg_dump/filter.c @@ -185,14 +185,14 @@ filter_get_keyword(const char **line, int *size) *size = 0; /* Skip initial whitespace */ - while (isspace(*ptr)) + while (isspace((unsigned char) *ptr)) ptr++; - if (isalpha(*ptr)) + if (isalpha((unsigned char) *ptr)) { result = ptr++; - while (isalpha(*ptr) || *ptr == '_') + while (isalpha((unsigned char) *ptr) || *ptr == '_') ptr++; *size = ptr - result; @@ -301,7 +301,7 @@ read_pattern(FilterStateData *fstate, const char *str, PQExpBuffer pattern) bool found_space = false; /* Skip initial whitespace */ - while (isspace(*str)) + while (isspace((unsigned char) *str)) str++; if (*str == '\0') @@ -312,7 +312,7 @@ read_pattern(FilterStateData *fstate, const char *str, PQExpBuffer pattern) while (*str && *str != '#') { - while (*str && !isspace(*str) && !strchr("#,.()\"", *str)) + while (*str && !isspace((unsigned char) *str) && !strchr("#,.()\"", *str)) { /* * Append space only when it is allowed, and when it was found in @@ -351,7 +351,7 @@ read_pattern(FilterStateData *fstate, const char *str, PQExpBuffer pattern) found_space = false; /* skip ending whitespaces */ - while (isspace(*str)) + while (isspace((unsigned char) *str)) { found_space = true; str++; @@ -400,7 +400,7 @@ filter_read_item(FilterStateData *fstate, fstate->lineno++; /* Skip initial white spaces */ - while (isspace(*str)) + while (isspace((unsigned char) *str)) str++; /*