Skip to content

Commit b43bf61

Browse files
committed
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.
1 parent 4262e61 commit b43bf61

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/interfaces/libpq/fe-exec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2386,7 +2386,7 @@ PQresultStatus(const PGresult *res)
23862386
char *
23872387
PQresStatus(ExecStatusType status)
23882388
{
2389-
if (status < 0 || status >= sizeof pgresStatus / sizeof pgresStatus[0])
2389+
if ((unsigned int) status >= sizeof pgresStatus / sizeof pgresStatus[0])
23902390
return libpq_gettext("invalid ExecStatusType code");
23912391
return pgresStatus[status];
23922392
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy