Don't explicitly dereference function pointers in calls. No

functional changes.
This commit is contained in:
Markus Armbruster 2006-04-16 17:42:19 +00:00
parent 4836f6c543
commit 8fea65f73f
3 changed files with 7 additions and 9 deletions

View file

@ -40,8 +40,7 @@ as_extend(struct as_data *adp)
head = adp->head; head = adp->head;
/* Find the neighboring coordinates. */ /* Find the neighboring coordinates. */
i = (*adp->neighbor) (head->np->c, adp->neighbor_coords, i = adp->neighbor(head->np->c, adp->neighbor_coords, adp->userdata);
adp->userdata);
if (i == 0) if (i == 0)
return NULL; return NULL;
/* /*

View file

@ -34,7 +34,7 @@ as_iscinq(struct as_data *adp, struct as_coord c)
int hashval; int hashval;
struct as_hash *hp; struct as_hash *hp;
hashval = (*adp->hash) (c) % adp->hashsize; hashval = adp->hash(c) % adp->hashsize;
for (hp = adp->hashtab[hashval]; hp; hp = hp->next) for (hp = adp->hashtab[hashval]; hp; hp = hp->next)
if (hp->c.x == c.x && hp->c.y == c.y) if (hp->c.x == c.x && hp->c.y == c.y)
@ -57,7 +57,7 @@ as_setcinq(struct as_data *adp, struct as_coord c, struct as_queue *qp)
new->c = c; new->c = c;
new->qp = qp; new->qp = qp;
hashval = (*adp->hash) (c) % adp->hashsize; hashval = adp->hash(c) % adp->hashsize;
hp = adp->hashtab[hashval]; hp = adp->hashtab[hashval];
new->next = (hp) ? hp : NULL; new->next = (hp) ? hp : NULL;

View file

@ -59,8 +59,7 @@ as_winnow(struct as_data *adp, struct as_coord *coords, int ncoords)
for (cp = coords, end = coords + ncoords; cp < end; cp++) { for (cp = coords, end = coords + ncoords; cp < end; cp++) {
fix_pointer = 0; fix_pointer = 0;
incknowncost = (*adp->realcost) (adp->head->np->c, *cp, incknowncost = adp->realcost(adp->head->np->c, *cp, adp->userdata);
adp->userdata);
knowncost = adp->head->np->knowncost + incknowncost; knowncost = adp->head->np->knowncost + incknowncost;
/* /*
* If this neighbor is already in the queue, we can * If this neighbor is already in the queue, we can
@ -68,7 +67,7 @@ as_winnow(struct as_data *adp, struct as_coord *coords, int ncoords)
*/ */
qp = as_iscinq(adp, *cp); qp = as_iscinq(adp, *cp);
inclbcost = qp ? qp->np->inclbcost : inclbcost = qp ? qp->np->inclbcost :
(*adp->lbcost) (*cp, adp->to, adp->userdata); adp->lbcost(*cp, adp->to, adp->userdata);
if (inclbcost < 0.0) /* skip bad cases */ if (inclbcost < 0.0) /* skip bad cases */
continue; continue;
lbcost = knowncost + inclbcost; lbcost = knowncost + inclbcost;
@ -133,8 +132,8 @@ as_winnow(struct as_data *adp, struct as_coord *coords, int ncoords)
if (qp) if (qp)
seccost = qp->np->seccost; seccost = qp->np->seccost;
else else
seccost = (adp->seccost) ? seccost = adp->seccost ?
(*adp->seccost) (*cp, adp->to, adp->userdata) : 0.0; adp->seccost(*cp, adp->to, adp->userdata) : 0.0;
np = as_newnode(adp->head->np, *cp, inclbcost, lbcost, np = as_newnode(adp->head->np, *cp, inclbcost, lbcost,
knowncost, seccost); knowncost, seccost);
if (np == NULL) if (np == NULL)