p = s1 + (len1 - len2);
while (p >= s1) {
if (strncmp(p, s2, len2) == 0)
- return (p - s1);
+ return p - s1;
else
p--;
}
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;
}
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)) {
{
Agraph_t* ng;
- if (!name || (*name == '\0'))
+ if (!name || *name == '\0')
name = agnameof (g);
ng = openG(name, g->desc);
if (ng) {
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;
}
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
{
int rv;
- if ((0 <= fd) && (fd <= 2)) {
+ if (0 <= fd && fd <= 2) {
exerror("closeF: cannot close standard stream %d", fd);
return -1;
}
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);
/* 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;
}
/* 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) {
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) /
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;
int rc;
int alpha;
- if ((*fmt == '\0') || (*incolor == '\0'))
+ if (*fmt == '\0' || *incolor == '\0')
return "";
if (*fmt == 'R') {
type = RGBA_BYTE;