From: Matthew Fernandez Date: Wed, 28 Dec 2022 22:17:34 +0000 (-0800) Subject: circogen: remove unnecessary parens X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8b1c059d23b1c62b4906b4f7b398ca2b40ce9ac6;p=graphviz circogen: remove unnecessary parens --- diff --git a/lib/circogen/blockpath.c b/lib/circogen/blockpath.c index f9a01ce35..ecc490b0b 100644 --- a/lib/circogen/blockpath.c +++ b/lib/circogen/blockpath.c @@ -216,7 +216,7 @@ static Agraph_t *remove_pair_edges(Agraph_t * ing) nodeCount = agnnodes(g); deglist_t dl = getList(g); - while (counter < (nodeCount - 3)) { + while (counter < nodeCount - 3) { currnode = deglist_is_empty(&dl) ? NULL : deglist_pop(&dl); /* Remove all adjacent nodes since they have to be reinserted */ @@ -270,7 +270,7 @@ measure_distance(Agnode_t * n, Agnode_t * ancestor, int dist, DISTONE(parent) = dist; } else if (dist > DISTONE(parent)) { if (LEAFONE(parent) != change) { - if (!DISTTWO(parent) || (LEAFTWO(parent) != change)) + if (!DISTTWO(parent) || LEAFTWO(parent) != change) change = LEAFONE(parent); LEAFTWO(parent) = LEAFONE(parent); DISTTWO(parent) = DISTONE(parent); @@ -443,7 +443,7 @@ static int count_all_crossings(nodelist_t * list, Agraph_t * subg) eitem = dtnext(openEdgeList, eitem)) { ep = eitem->edge; if (EDGEORDER(ep) > EDGEORDER(e)) { - if ((aghead(ep) != n) && (agtail(ep) != n)) + if (aghead(ep) != n && agtail(ep) != n) crossings++; } } @@ -524,7 +524,7 @@ static nodelist_t *reduce_edge_crossings(nodelist_t * list, origCrossings = crossings; list = reduce(list, subg, &crossings); /* return if no crossings or no improvement */ - if ((origCrossings == crossings) || (crossings == 0)) + if (origCrossings == crossings || crossings == 0) return list; } return list; @@ -645,7 +645,7 @@ nodelist_t *layout_block(Agraph_t * g, block_t * sn, double min_dist) if (N == 1) radius = 0; else - radius = (N * (min_dist + largest_node)) / (2 * M_PI); + radius = N * (min_dist + largest_node) / (2 * M_PI); for (item = longest_path->first; item; item = item->next) { n = item->curr; @@ -661,7 +661,7 @@ nodelist_t *layout_block(Agraph_t * g, block_t * sn, double min_dist) n = item->curr; POSITION(n) = k; PSI(n) = 0.0; - theta = k * ((2.0 * M_PI) / N); + theta = k * (2.0 * M_PI / N); ND_pos(n)[0] = radius * cos(theta); ND_pos(n)[1] = radius * sin(theta); diff --git a/lib/circogen/blocktree.c b/lib/circogen/blocktree.c index 86069435f..d5d2f2de9 100644 --- a/lib/circogen/blocktree.c +++ b/lib/circogen/blocktree.c @@ -121,7 +121,7 @@ static void dfs(Agraph_t * g, Agnode_t * u, circ_state * state, int isRoot, esta if (block) { /* If block != NULL, it's not empty */ if (!BLOCK(u) && blockSize (block) > 1) addNode(block, u); - if (isRoot && (BLOCK(u) == block)) + if (isRoot && BLOCK(u) == block) insertBlock(&state->bl, block); else appendBlock(&state->bl, block); @@ -213,7 +213,7 @@ block_t *createBlocktree(Agraph_t * g, circ_state * state) SET_PARENT(parent); CHILD(bp) = child; next = bp->next; /* save next since list insertion destroys it */ - appendBlock(&(BLOCK(parent)->children), bp); + appendBlock(&BLOCK(parent)->children, bp); } initBlocklist(&state->bl); /* zero out list */ return root; diff --git a/lib/circogen/circpos.c b/lib/circogen/circpos.c index b59354c04..f66866da4 100644 --- a/lib/circogen/circpos.c +++ b/lib/circogen/circpos.c @@ -67,7 +67,7 @@ static double getRotation(block_t *sn, double x, double y, double theta) { count = sizeNodelist(list); if (count == 2) { - return (theta - M_PI / 2.0); + return theta - M_PI / 2.0; } /* Find node in block connected to block's parent */ @@ -95,13 +95,13 @@ static double getRotation(block_t *sn, double x, double y, double theta) { double rho = sn->rad0; double r = sn->radius - rho; double n_x = ND_pos(neighbor)[0]; - if (COALESCED(sn) && (-r < n_x)) { + if (COALESCED(sn) && -r < n_x) { double R = LEN(x, y); double n_y = ND_pos(neighbor)[1]; double phi = atan2(n_y, n_x + r); - double l = r - rho / (cos(phi)); + double l = r - rho / cos(phi); - theta += M_PI / 2.0 - phi - asin((l / R) * (cos(phi))); + theta += M_PI / 2.0 - phi - asin(l / R * cos(phi)); } else { /* Origin still at center of this block */ double phi = atan2(ND_pos(neighbor)[1], ND_pos(neighbor)[0]); theta += M_PI - phi - PSI(neighbor); @@ -219,7 +219,7 @@ getInfo (posinfo_t* pi, posstate * stp, double min_dist) static void setInfo (posinfo_t* p0, posinfo_t* p1, double delta) { - double t = (p0->diameter*p1->minRadius) + (p1->diameter*p0->minRadius); + double t = p0->diameter * p1->minRadius + p1->diameter * p0->minRadius; t /= 2*delta*p0->minRadius*p1->minRadius; @@ -309,7 +309,7 @@ positionChildren(posinfo_t *pi, posstate *stp, int length, double min_dist) midAngle = childAngle; } - if ((length > 1) && (pi->n == stp->neighbor)) { + if (length > 1 && pi->n == stp->neighbor) { PSI(pi->n) = midAngle; } @@ -440,7 +440,7 @@ static void doBlock(Agraph_t * g, block_t * sn, double min_dist) if (childCount > 0) centerAngle = position(childCount, length, longest_path, sn, min_dist); - if ((length == 1) && (BLK_PARENT(sn))) { + if (length == 1 && BLK_PARENT(sn)) { sn->parent_pos = centerAngle; if (sn->parent_pos < 0) sn->parent_pos += 2 * M_PI;