dump: use NULL instead of zero for pointers.

Clean out the casts from calloc(3) while here.
This commit is contained in:
Pedro F. Giffuni 2016-04-19 19:13:33 +00:00
parent f3858ada3e
commit 4c8762f037
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=298288
2 changed files with 5 additions and 6 deletions

View File

@ -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)

View File

@ -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",