aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2011-08-05 12:06:29 -0400
committerRobert Haas <rhaas@postgresql.org>2011-08-05 12:06:29 -0400
commitb43bf617fdb3ecde709892c3bd8997ac41410f2f (patch)
treefe0269bc692a3511249a22cbb1d956f1e31c1c25
parent4262e61d6424a38150f125b612fd900267718148 (diff)
downloadpostgresql-b43bf617fdb3ecde709892c3bd8997ac41410f2f.tar.gz
postgresql-b43bf617fdb3ecde709892c3bd8997ac41410f2f.zip
Tweak PQresStatus() to avoid a clang compiler warning.
The previous test for status < 0 test is in fact testing nothing if the compiler considers an enum to be an unsigned data type. clang doesn't like tautologies, so do this instead. Report by Peter Geoghegan, fix as suggested by Tom Lane.
-rw-r--r--src/interfaces/libpq/fe-exec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index 605d2428092..113aab086dc 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -2386,7 +2386,7 @@ PQresultStatus(const PGresult *res)
char *
PQresStatus(ExecStatusType status)
{
- if (status < 0 || status >= sizeof pgresStatus / sizeof pgresStatus[0])
+ if ((unsigned int) status >= sizeof pgresStatus / sizeof pgresStatus[0])
return libpq_gettext("invalid ExecStatusType code");
return pgresStatus[status];
}