Deleted Added
full compact
31a32,33
> *
> * $FreeBSD: head/lib/libc/gen/telldir.c 69656 2000-12-06 03:15:49Z deischen $
56,57c58,59
< struct ddloc {
< struct ddloc *loc_next;/* next structure in list */
---
> struct _ddloc {
> LIST_ENTRY(_ddloc) loc_lqe; /* entry in list */
61d62
< const DIR* loc_dirp; /* directory which used this entry */
64,69d64
< #define NDIRHASH 32 /* Num of hash lists, must be a power of 2 */
< #define LOCHASH(i) ((i)&(NDIRHASH-1))
<
< static long dd_loccnt; /* Index of entry for sequential readdir's */
< static struct ddloc *dd_hash[NDIRHASH]; /* Hash list heads for ddlocs */
<
75c70
< const DIR *dirp;
---
> DIR *dirp;
77,78c72
< register int index;
< register struct ddloc *lp;
---
> struct _ddloc *lp;
80c74
< if ((lp = (struct ddloc *)malloc(sizeof(struct ddloc))) == NULL)
---
> if ((lp = (struct _ddloc *)malloc(sizeof(struct _ddloc))) == NULL)
82,83c76
< index = dd_loccnt++;
< lp->loc_index = index;
---
> lp->loc_index = dirp->dd_loccnt++;
86,89c79,80
< lp->loc_dirp = dirp;
< lp->loc_next = dd_hash[LOCHASH(index)];
< dd_hash[LOCHASH(index)] = lp;
< return (index);
---
> LIST_INSERT_HEAD(&dirp->dd_locq, lp, loc_lqe);
> return (lp->loc_index);
98c89
< register DIR *dirp;
---
> DIR *dirp;
101,102c92
< register struct ddloc *lp;
< register struct ddloc **prevlp;
---
> struct _ddloc *lp;
105,107c95
< prevlp = &dd_hash[LOCHASH(loc)];
< lp = *prevlp;
< while (lp != NULL) {
---
> LIST_FOREACH(lp, &dirp->dd_locq, loc_lqe) {
110,111d97
< prevlp = &lp->loc_next;
< lp = lp->loc_next;
127c113
< *prevlp = lp->loc_next;
---
> LIST_REMOVE(lp, loc_lqe);
137c123
< register const DIR *dirp;
---
> DIR *dirp;
139,141c125,126
< register struct ddloc *lp;
< register struct ddloc **prevlp;
< int i;
---
> struct _ddloc *lp;
> struct _ddloc *templp;
143,155c128,132
< for (i = 0; i < NDIRHASH; i++) {
< prevlp = &dd_hash[i];
< lp = *prevlp;
< while (lp != NULL) {
< if (lp->loc_dirp == dirp) {
< *prevlp = lp->loc_next;
< free((caddr_t)lp);
< lp = *prevlp;
< continue;
< }
< prevlp = &lp->loc_next;
< lp = lp->loc_next;
< }
---
> lp = LIST_FIRST(&dirp->dd_locq);
> while (lp != NULL) {
> templp = lp;
> lp = LIST_NEXT(lp, loc_lqe);
> free(templp);
156a134
> LIST_INIT(&dirp->dd_locq);