summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-04-19 19:13:33 +0000
committerpfg <pfg@FreeBSD.org>2016-04-19 19:13:33 +0000
commit5c1c83ba38c67d797734d182efc33de16f5b36af (patch)
treeef2fe92c7e7f24b5aed6d6e65e6a0cfcf2ac3395
parentd3a3a9284808258832ed7214013b3c2113d7b870 (diff)
downloadFreeBSD-src-5c1c83ba38c67d797734d182efc33de16f5b36af.zip
FreeBSD-src-5c1c83ba38c67d797734d182efc33de16f5b36af.tar.gz
dump: use NULL instead of zero for pointers.
Clean out the casts from calloc(3) while here.
-rw-r--r--sbin/dump/itime.c9
-rw-r--r--sbin/dump/main.c2
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",
OpenPOWER on IntegriCloud