svn commit: r298288 - head/sbin/dump
Pedro F. Giffuni
pfg at FreeBSD.org
Tue Apr 19 19:13:34 UTC 2016
Author: pfg
Date: Tue Apr 19 19:13:33 2016
New Revision: 298288
URL: https://svnweb.freebsd.org/changeset/base/298288
Log:
dump: use NULL instead of zero for pointers.
Clean out the casts from calloc(3) while here.
Modified:
head/sbin/dump/itime.c
head/sbin/dump/main.c
Modified: head/sbin/dump/itime.c
==============================================================================
--- head/sbin/dump/itime.c Tue Apr 19 19:08:44 2016 (r298287)
+++ head/sbin/dump/itime.c Tue Apr 19 19:13:33 2016 (r298288)
@@ -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)
Modified: head/sbin/dump/main.c
==============================================================================
--- head/sbin/dump/main.c Tue Apr 19 19:08:44 2016 (r298287)
+++ head/sbin/dump/main.c Tue Apr 19 19:13:33 2016 (r298288)
@@ -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",
More information about the svn-src-all
mailing list