[PATCH v2 1/3] xfs_repair: reformat lines to fit within 80 characters

Mike Grant
2015-06-19T15:04:18Z

Also introduces a const to improve readability

Signed-off-by: Mike Grant <mggr@pml.ac.uk>
---
repair/phase6.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/repair/phase6.c b/repair/phase6.c
index 105bce4..6520196 100644
--- a/repair/phase6.c
+++ b/repair/phase6.c
@@ -2267,6 +2267,7 @@ longform_dir2_entry_check(xfs_mount_t *mp,
dir_hash_tab_t *hashtab)
{
struct xfs_buf **bplist;
+ const size_t bpsz = sizeof(struct xfs_buf*);
xfs_dablk_t da_bno;
freetab_t *freetab;
int num_bps;
@@ -2293,10 +2294,10 @@ longform_dir2_entry_check(xfs_mount_t *mp,
freetab->ents[i].s = 0;
}
num_bps = freetab->naents;
- bplist = calloc(num_bps, sizeof(struct xfs_buf*));
+ bplist = calloc(num_bps, bpsz);
if (!bplist)
do_error(_("calloc failed in %s (%zu bytes)\n"),
- __func__, num_bps * sizeof(struct xfs_buf*));
+ __func__, num_bps * bpsz);

/* is this a block, leaf, or node directory? */
libxfs_dir2_isblock(NULL, ip, &isblock);
@@ -2327,11 +2328,12 @@ longform_dir2_entry_check(xfs_mount_t *mp,
if (db >= num_bps) {
/* more data blocks than expected */
num_bps = db + 1;
- bplist = realloc(bplist, num_bps * sizeof(struct xfs_buf*));
+ bplist = realloc(bplist, num_bps * bpsz);
if (!bplist)
- do_error(_("realloc failed in %s (%zu bytes)\n"),
+ do_error(
+ _("realloc failed in %s (%zu bytes)\n"),
__func__,
- num_bps * sizeof(struct xfs_buf*));
+ num_bps * bpsz);
}

if (isblock)