Suppress uninitialized-variable warnings.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 30 Mar 2016 17:36:18 +0000 (13:36 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 30 Mar 2016 17:36:18 +0000 (13:36 -0400)
My compiler doesn't like the lack of initialization of "flag", and
I think it's right: if there were zero keys we'd have an undefined
result.  The AND of zero items is TRUE, so initialize to TRUE.

src/backend/utils/adt/geo_spgist.c

index 7604f1e8eae4738db90727cd9ce8cf7df3c0fa7c..cd9db030dcf15c8f83df06c4efa4698827e2ab49 100644 (file)
@@ -515,8 +515,8 @@ spg_box_quad_inner_consistent(PG_FUNCTION_ARGS)
 
        for (quadrant = 0; quadrant < in->nNodes; quadrant++)
        {
-               bool            flag;
                RectBox    *next_rect_box = nextRectBox(rect_box, centroid, quadrant);
+               bool            flag = true;
 
                for (i = 0; i < in->nkeys; i++)
                {
@@ -609,7 +609,7 @@ spg_box_quad_leaf_consistent(PG_FUNCTION_ARGS)
        spgLeafConsistentIn *in = (spgLeafConsistentIn *) PG_GETARG_POINTER(0);
        spgLeafConsistentOut *out = (spgLeafConsistentOut *) PG_GETARG_POINTER(1);
        Datum           leaf = in->leafDatum;
-       bool            flag;
+       bool            flag = true;
        int                     i;
 
        /* All tests are exact. */