]> granicus.if.org Git - postgresql/commitdiff
Back-patch 9.4-era compiler warning fixes into older branches.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 17 Feb 2017 21:58:26 +0000 (16:58 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 17 Feb 2017 21:58:59 +0000 (16:58 -0500)
This applies portions of commits b64b5ccb6 and b1aebbb6a to the older
branches, in hopes of getting -Werror builds to succeed there.  The
applied changes simply remove useless tests, eg checking an unsigned
variable to see if it is >= 0.  Recent versions of clang warn about
such tests by default.

contrib/pg_standby/pg_standby.c
src/interfaces/libpq/fe-exec.c

index 67a2d30e6177026504080ccf1d281dc324d586c0..4758833d247b01bf3f4feceeb452c434b3811078 100644 (file)
@@ -358,7 +358,7 @@ SetWALFileNameForCleanup(void)
        if (keepfiles > 0)
        {
                sscanf(nextWALFileName, "%08X%08X%08X", &tli, &log, &seg);
-               if (tli > 0 && log >= 0 && seg > 0)
+               if (tli > 0 && seg > 0)
                {
                        log_diff = keepfiles / MaxSegmentsPerLogFile;
                        seg_diff = keepfiles % MaxSegmentsPerLogFile;
index 6e0dcb62e7281f6ff6876e330d01b3abcd40b968..6f65669b782cde449dac6c9402a21f73df6ec4c0 100644 (file)
@@ -2872,7 +2872,7 @@ PQoidStatus(const PGresult *res)
 
        size_t          len;
 
-       if (!res || !res->cmdStatus || strncmp(res->cmdStatus, "INSERT ", 7) != 0)
+       if (!res || strncmp(res->cmdStatus, "INSERT ", 7) != 0)
                return "";
 
        len = strspn(res->cmdStatus + 7, "0123456789");
@@ -2896,7 +2896,6 @@ PQoidValue(const PGresult *res)
        unsigned long result;
 
        if (!res ||
-               !res->cmdStatus ||
                strncmp(res->cmdStatus, "INSERT ", 7) != 0 ||
                res->cmdStatus[7] < '0' ||
                res->cmdStatus[7] > '9')