Remove some redundant parenthesis; no functional change.

This commit is contained in:
Markus Armbruster 2005-07-23 19:48:35 +00:00
parent 4861f837fb
commit 380b063f9c
41 changed files with 134 additions and 134 deletions

View file

@ -176,20 +176,20 @@ as_find_cachepath(coord fx, coord fy, coord tx, coord ty)
/* Is the cache on? if not, return NULL */
if (as_cachepath_on == 0)
return (NULL);
return NULL;
/* Do we have any cached? */
if (fromhead == (struct as_frompath **)0)
return (NULL);
return NULL;
/* Yes! */
for (from = fromhead[fy]; from; from = from->next) {
if (from->x == fx) {
for (to = from->tolist[ty]; to; to = to->next) {
if (to->x == tx)
return (to->path);
return to->path;
}
}
}
return (NULL);
return NULL;
}

View file

@ -33,15 +33,15 @@ as_costcomp(const void *p1, const void *p2)
diff = (*n1)->lbcost - (*n2)->lbcost;
if (diff < -0.0001)
return (-1);
return -1;
if (diff > 0.0001)
return (1);
return 1;
/* equal, check secondary cost */
diff = (*n1)->seccost - (*n2)->seccost;
if (diff < -0.0001)
return (-1);
return -1;
if (diff > 0.0001)
return (1);
return (0);
return 1;
return 0;
}

View file

@ -40,14 +40,14 @@ as_extend(struct as_data *adp)
i = (*adp->neighbor) (head->np->c, adp->neighbor_coords,
adp->userdata);
if (i == 0)
return (NULL);
return NULL;
/*
* Get rid of neighbors that are more costly than ones we already have,
* and sort the rest into an array of as_nodes.
*/
i = as_winnow(adp, adp->neighbor_coords, i);
if (i < 0)
return (NULL);
return NULL;
if (i > 1)
qsort(adp->neighbor_nodes, i,
sizeof(*adp->neighbor_nodes), as_costcomp);
@ -66,5 +66,5 @@ as_extend(struct as_data *adp)
adp->tried->np->flags |= AS_TRIED;
head = as_merge(adp, head, adp->neighbor_nodes);
return (head);
return head;
}

View file

@ -35,9 +35,9 @@ as_iscinq(struct as_data *adp, struct as_coord c)
for (hp = adp->hashtab[hashval]; hp; hp = hp->next)
if (hp->c.x == c.x && hp->c.y == c.y)
return (hp->qp);
return hp->qp;
return (NULL);
return NULL;
}
/*

View file

@ -54,5 +54,5 @@ as_init(int maxneighbors,
adp->seccost = seccostfunc;
adp->userdata = userdata;
return (adp);
return adp;
}

View file

@ -77,5 +77,5 @@ as_merge(struct as_data *adp, struct as_queue *head,
np->step++;
}
return (head);
return head;
}

View file

@ -99,7 +99,7 @@ as_search(struct as_data *adp)
#ifdef DEBUG
fprintf(stderr, "Failed\n");
#endif /* DEBUG */
return (-1);
return -1;
}
as_makepath(adp);
@ -121,7 +121,7 @@ as_search(struct as_data *adp)
}
#endif /* DEBUG */
return (0);
return 0;
}
/*

View file

@ -91,7 +91,7 @@ as_winnow(struct as_data *adp, struct as_coord *coords, int ncoords)
#endif /* DEBUG */
if (qp->np->flags & AS_TRIED) {
/* should "never happen" */
return (0);
return 0;
}
/*
* The neighbor is better than a previously visited coordinate;
@ -135,7 +135,7 @@ as_winnow(struct as_data *adp, struct as_coord *coords, int ncoords)
np = as_newnode(adp->head->np, *cp, inclbcost, lbcost,
knowncost, seccost);
if (np == NULL)
return (0);
return 0;
if (fix_pointer) {
#ifdef DEBUG
fprintf(stderr, "Fixing pointer for %d, %d\n",
@ -148,7 +148,7 @@ as_winnow(struct as_data *adp, struct as_coord *coords, int ncoords)
}
adp->neighbor_nodes[i] = NULL;
return (i);
return i;
}
@ -170,5 +170,5 @@ as_newnode(struct as_node *backp, struct as_coord c,
np->step = backp->step;
np->back = backp;
return (np);
return np;
}