From: Matthew Fernandez Date: Wed, 4 Jan 2023 03:52:39 +0000 (-0800) Subject: ortho: use zero initialization for 'boxf' variables X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b914ce7937896ba530802b0a4bd06973e7b97a9;p=graphviz ortho: use zero initialization for 'boxf' variables 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. --- diff --git a/lib/ortho/partition.c b/lib/ortho/partition.c index 7d7835acc..b349a552e 100644 --- a/lib/ortho/partition.c +++ b/lib/ortho/partition.c @@ -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); }