diff options
author | phk <phk@FreeBSD.org> | 2001-01-29 09:45:51 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2001-01-29 09:45:51 +0000 |
commit | 77061a115db551088140aca8fbf1c9fc34628464 (patch) | |
tree | 93ce4ef74ab7c798d7b69dc54b7152f869b8f57b /sbin/dump/itime.c | |
parent | 2f446fa4553d73402dc952ae2f348a80942113e2 (diff) | |
download | FreeBSD-src-77061a115db551088140aca8fbf1c9fc34628464.zip FreeBSD-src-77061a115db551088140aca8fbf1c9fc34628464.tar.gz |
Use <sys/queue.h> instead of home-rolled list.
Submitted by: "Jason Smethers" <jsmethers@pdq.net>
Diffstat (limited to 'sbin/dump/itime.c')
-rw-r--r-- | sbin/dump/itime.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sbin/dump/itime.c b/sbin/dump/itime.c index 6209dab..cd60c9e 100644 --- a/sbin/dump/itime.c +++ b/sbin/dump/itime.c @@ -40,6 +40,7 @@ static const char rcsid[] = #endif /* not lint */ #include <sys/param.h> +#include <sys/queue.h> #include <sys/time.h> #ifdef sunos #include <sys/vnode.h> @@ -63,10 +64,14 @@ static const char rcsid[] = #include "dump.h" +struct dumptime { + struct dumpdates dt_value; + SLIST_ENTRY(dumptime) dt_list; +}; +SLIST_HEAD(dthead, dumptime) dthead = SLIST_HEAD_INITIALIZER(dthead); struct dumpdates **ddatev = 0; int nddates = 0; int ddates_in = 0; -struct dumptime *dthead = 0; static void dumprecout __P((FILE *, struct dumpdates *)); static int getrecord __P((FILE *, struct dumpdates *)); @@ -117,8 +122,7 @@ readdumptimes(df) if (getrecord(df, &(dtwalk->dt_value)) < 0) break; nddates++; - dtwalk->dt_next = dthead; - dthead = dtwalk; + SLIST_INSERT_HEAD(&dthead, dtwalk, dt_list); } ddates_in = 1; @@ -128,8 +132,8 @@ readdumptimes(df) */ ddatev = (struct dumpdates **) calloc((unsigned) (nddates + 1), sizeof (struct dumpdates *)); - dtwalk = dthead; - for (i = nddates - 1; i >= 0; i--, dtwalk = dtwalk->dt_next) + dtwalk = SLIST_FIRST(&dthead); + for (i = nddates - 1; i >= 0; i--, dtwalk = SLIST_NEXT(dtwalk, dt_list)) ddatev[i] = &dtwalk->dt_value; } @@ -184,7 +188,6 @@ putdumptime() free((char *)ddatev); ddatev = 0; nddates = 0; - dthead = 0; ddates_in = 0; readdumptimes(df); if (fseek(df, 0L, 0) < 0) |