From 5c1c83ba38c67d797734d182efc33de16f5b36af Mon Sep 17 00:00:00 2001 From: pfg Date: Tue, 19 Apr 2016 19:13:33 +0000 Subject: dump: use NULL instead of zero for pointers. Clean out the casts from calloc(3) while here. --- sbin/dump/itime.c | 9 ++++----- sbin/dump/main.c | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sbin/dump/itime.c b/sbin/dump/itime.c index 909b8ab..e57faa5 100644 --- a/sbin/dump/itime.c +++ b/sbin/dump/itime.c @@ -58,7 +58,7 @@ struct dumptime { SLIST_ENTRY(dumptime) dt_list; }; SLIST_HEAD(dthead, dumptime) dthead = SLIST_HEAD_INITIALIZER(dthead); -struct dumpdates **ddatev = 0; +struct dumpdates **ddatev = NULL; int nddates = 0; static void dumprecout(FILE *, const struct dumpdates *); @@ -118,8 +118,7 @@ readdumptimes(FILE *df) * arrayify the list, leaving enough room for the additional * record that we may have to add to the ddate structure */ - ddatev = (struct dumpdates **) - calloc((unsigned) (nddates + 1), sizeof (struct dumpdates *)); + ddatev = calloc((unsigned) (nddates + 1), sizeof (struct dumpdates *)); dtwalk = SLIST_FIRST(&dthead); for (i = nddates - 1; i >= 0; i--, dtwalk = SLIST_NEXT(dtwalk, dt_list)) ddatev[i] = &dtwalk->dt_value; @@ -174,8 +173,8 @@ putdumptime(void) fd = fileno(df); (void) flock(fd, LOCK_EX); fname = disk; - free((char *)ddatev); - ddatev = 0; + free(ddatev); + ddatev = NULL; nddates = 0; readdumptimes(df); if (fseek(df, 0L, 0) < 0) diff --git a/sbin/dump/main.c b/sbin/dump/main.c index 3ec78fd1..ee18f82 100644 --- a/sbin/dump/main.c +++ b/sbin/dump/main.c @@ -340,7 +340,7 @@ main(int argc, char *argv[]) spcl.c_dev[NAMELEN-1]='\0'; spcl.c_filesys[NAMELEN-1]='\0'; - if ((mntpt = getmntpt(disk, &mntflags)) != 0) { + if ((mntpt = getmntpt(disk, &mntflags)) != NULL) { if (mntflags & MNT_RDONLY) { if (snapdump != 0) { msg("WARNING: %s\n", -- cgit v1.1