]> granicus.if.org Git - graphviz/commitdiff
ortho: use zero initialization for 'boxf' variables
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 4 Jan 2023 03:52:39 +0000 (19:52 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 8 Jan 2023 19:57:18 +0000 (11:57 -0800)
This was phrased as `{{0}}` to avoid a compiler warning on CentOS 7 about the
LHS being a nested struct. However it turns out this is a false positive in
older versions of GCC, and this form of zero initialization should be valid for
any aggregate in C99. Accordingly _newer_ versions of GCC warn if you use this
double braced phrasing. This change switches to the more standard C99
initialization, squashing warnings on newer platforms at the expense of
reintroducing some warnings on CentOS 7.

lib/ortho/partition.c

index 7d7835acc4b56936d0bf9c270a70a3970170e09d..b349a552ebda712e98cefae021c6e9a78ebefa58 100644 (file)
@@ -331,7 +331,7 @@ static void traverse_polygon(bitarray_t *visited, boxes_t *decomp,
   
   if (t->hi.y > t->lo.y + C_EPS && FP_EQUAL(seg[t->lseg].v0.x, seg[t->lseg].v1.x) &&
       FP_EQUAL(seg[t->rseg].v0.x, seg[t->rseg].v1.x)) {
-      boxf newbox = {{0}};
+      boxf newbox = {0};
       if (flip) {
           newbox.LL.x = t->lo.y;
           newbox.LL.y = -seg[t->rseg].v0.x;
@@ -724,7 +724,7 @@ boxf *partition(cell *cells, int ncells, size_t *nrects, boxf bb) {
     boxes_t rs = {0};
     for (size_t i = 0; i < vert_decomp.size; ++i)
        for (size_t j = 0; j < hor_decomp.size; ++j) {
-           boxf newbox = {{0}};
+           boxf newbox = {0};
            if (rectIntersect(&newbox, &vert_decomp.data[i], &hor_decomp.data[j]))
                boxes_append(&rs, newbox);
        }