mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-09 04:57:59 -05:00
diskspace: use calloc instead of malloc
Prevents us from having to manually zero out several of our fields. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
0eac60cd9d
commit
1358a4a80f
@ -81,15 +81,11 @@ static alpm_list_t *mount_point_list(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
MALLOC(mp, sizeof(alpm_mountpoint_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
mp->mount_dir = strdup(mnt->mnt_dir);
|
mp->mount_dir = strdup(mnt->mnt_dir);
|
||||||
mp->mount_dir_len = strlen(mp->mount_dir);
|
mp->mount_dir_len = strlen(mp->mount_dir);
|
||||||
memcpy(&(mp->fsp), &fsp, sizeof(FSSTATSTYPE));
|
memcpy(&(mp->fsp), &fsp, sizeof(FSSTATSTYPE));
|
||||||
|
|
||||||
mp->blocks_needed = 0l;
|
|
||||||
mp->max_blocks_needed = 0l;
|
|
||||||
mp->used = 0;
|
|
||||||
|
|
||||||
mount_points = alpm_list_add(mount_points, mp);
|
mount_points = alpm_list_add(mount_points, mp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,15 +101,11 @@ static alpm_list_t *mount_point_list(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(; entries-- > 0; fsp++) {
|
for(; entries-- > 0; fsp++) {
|
||||||
MALLOC(mp, sizeof(alpm_mountpoint_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(PM_ERR_MEMORY, NULL));
|
||||||
mp->mount_dir = strdup(fsp->f_mntonname);
|
mp->mount_dir = strdup(fsp->f_mntonname);
|
||||||
mp->mount_dir_len = strlen(mp->mount_dir);
|
mp->mount_dir_len = strlen(mp->mount_dir);
|
||||||
memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE));
|
memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE));
|
||||||
|
|
||||||
mp->blocks_needed = 0l;
|
|
||||||
mp->max_blocks_needed = 0l;
|
|
||||||
mp->used = 0;
|
|
||||||
|
|
||||||
mount_points = alpm_list_add(mount_points, mp);
|
mount_points = alpm_list_add(mount_points, mp);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user