Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-02-11 10:36:41 -0600
committerDan McGee <dan@archlinux.org>2011-02-11 10:36:41 -0600
commit1358a4a80f4d8edbeedc0fdd1e026b491cbb8815 (patch)
tree3206fdf0b30f6acd90db3c0e55758a0cb17ab760 /lib
parent0eac60cd9d478774025a10decce835dea42f9ce4 (diff)
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/diskspace.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
index 420a2496..96f73008 100644
--- a/lib/libalpm/diskspace.c
+++ b/lib/libalpm/diskspace.c
@@ -81,15 +81,11 @@ static alpm_list_t *mount_point_list(void)
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_len = strlen(mp->mount_dir);
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);
}
@@ -105,15 +101,11 @@ static alpm_list_t *mount_point_list(void)
}
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_len = strlen(mp->mount_dir);
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);
}
#endif