From: Matthew Fernandez Date: Wed, 24 Feb 2021 03:20:55 +0000 (-0800) Subject: remove some unnecessary bracketing X-Git-Tag: 2.47.0~17^2~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=88507af7bf27284bc7f2402afc1d974f13a53fba;p=graphviz remove some unnecessary bracketing --- diff --git a/lib/gvpr/actions.c b/lib/gvpr/actions.c index e5f39986f..23501a4cc 100644 --- a/lib/gvpr/actions.c +++ b/lib/gvpr/actions.c @@ -76,7 +76,7 @@ int rindexOf(char *s1, char *s2) p = s1 + (len1 - len2); while (p >= s1) { if (strncmp(p, s2, len2) == 0) - return (p - s1); + return p - s1; else p--; } @@ -171,7 +171,7 @@ Agobj_t *copy(Agraph_t * g, Agobj_t * obj) int kind = AGTYPE(obj); char *name; - if ((kind != AGRAPH) && !g) { + if (kind != AGRAPH && !g) { exerror("NULL graph with non-graph object in copy()"); return 0; } @@ -230,7 +230,7 @@ static Agraph_t *cloneSubg(Agraph_t * tgt, Agraph_t * g, Dt_t* emap) Agedge_t *newe; char* name; - ng = (Agraph_t *) (copy(tgt, OBJ(g))); + ng = (Agraph_t *) copy(tgt, OBJ(g)); if (!ng) return 0; for (t = agfstnode(g); t; t = agnxtnode(g, t)) { @@ -348,7 +348,7 @@ Agraph_t *cloneG(Agraph_t * g, char* name) { Agraph_t* ng; - if (!name || (*name == '\0')) + if (!name || *name == '\0') name = agnameof (g); ng = openG(name, g->desc); if (ng) { @@ -375,7 +375,7 @@ Agobj_t *clone(Agraph_t * g, Agobj_t * obj) int kind = AGTYPE(obj); char *name; - if ((kind != AGRAPH) && !g) { + if (kind != AGRAPH && !g) { exerror("NULL graph with non-graph object in clone()"); return 0; } @@ -521,7 +521,7 @@ int lockGraph(Agraph_t * g, int v) oldv = data->lock & 1; if (v > 0) data->lock |= 1; - else if ((v == 0) && oldv) { + else if (v == 0 && oldv) { if (data->lock & 2) agclose(g); else @@ -679,7 +679,7 @@ int closeFile(Expr_t * ex, int fd) { int rv; - if ((0 <= fd) && (fd <= 2)) { + if (0 <= fd && fd <= 2) { exerror("closeF: cannot close standard stream %d", fd); return -1; } @@ -709,7 +709,7 @@ char *readLine(Expr_t * ex, int fd) return ""; } tmps = sfstropen(); - while (((c = sfgetc(sp)) > 0) && (c != '\n')) + while ((c = sfgetc(sp)) > 0 && c != '\n') sfputc(tmps, c); if (c == '\n') sfputc(tmps, c); @@ -1046,8 +1046,8 @@ int colorxlate(char *str, gvcolor_t * color, color_type_t target_type) /* test for rgb value such as: "#ff0000" or rgba value such as "#ff000080" */ a = 255; /* default alpha channel value=opaque in case not supplied */ - if ((*p == '#') - && (sscanf((char *) p, "#%2x%2x%2x%2x", &r, &g, &b, &a) >= 3)) { + if (*p == '#' + && sscanf((char *) p, "#%2x%2x%2x%2x", &r, &g, &b, &a) >= 3) { switch (target_type) { case HSVA_DOUBLE: R = (double) r / 255.0; @@ -1097,7 +1097,7 @@ int colorxlate(char *str, gvcolor_t * color, color_type_t target_type) } /* test for hsv value such as: ".6,.5,.3" */ - if (((c = *p) == '.') || isdigit(c)) { + if ((c = *p) == '.' || isdigit(c)) { int cnt; len = strlen((char*)p); if (len >= allocated) { @@ -1174,9 +1174,9 @@ int colorxlate(char *str, gvcolor_t * color, color_type_t target_type) fake.name = resolveColor(str); if (!fake.name) return COLOR_MALLOC_FAIL; - if ((last == NULL) - || (last->name[0] != fake.name[0]) - || (strcmp(last->name, fake.name))) { + if (last == NULL + || last->name[0] != fake.name[0] + || strcmp(last->name, fake.name)) { last = (hsvrgbacolor_t *) bsearch((void *) &fake, (void *) color_lib, sizeof(color_lib) / @@ -1186,10 +1186,10 @@ int colorxlate(char *str, gvcolor_t * color, color_type_t target_type) if (last != NULL) { switch (target_type) { case HSVA_DOUBLE: - color->u.HSVA[0] = ((double) last->h) / 255.0; - color->u.HSVA[1] = ((double) last->s) / 255.0; - color->u.HSVA[2] = ((double) last->v) / 255.0; - color->u.HSVA[3] = ((double) last->a) / 255.0; + color->u.HSVA[0] = (double) last->h / 255.0; + color->u.HSVA[1] = (double) last->s / 255.0; + color->u.HSVA[2] = (double) last->v / 255.0; + color->u.HSVA[3] = (double) last->a / 255.0; break; case RGBA_BYTE: color->u.rgba[0] = last->r; @@ -1268,7 +1268,7 @@ char *colorx (Expr_t* ex, char* incolor, char* fmt, Sfio_t* fp) int rc; int alpha; - if ((*fmt == '\0') || (*incolor == '\0')) + if (*fmt == '\0' || *incolor == '\0') return ""; if (*fmt == 'R') { type = RGBA_BYTE;