Skip to content

Commit ed61e32

Browse files
committed
flux-fsck: remove unnecessary function parameters
Problem: Several functions take in unnecessary function parameters. The value of the parameters are already passed in via a struct. Remove the unnecessary parameters.
1 parent 27932de commit ed61e32

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/cmd/builtin/fsck.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ static void fsck_treeobj (struct fsck_ctx *ctx,
6161
const char *path,
6262
json_t *treeobj);
6363

64-
static void valref_validate (struct fsck_valref_data *fvd,
65-
json_t *treeobj,
66-
int index);
64+
static void valref_validate (struct fsck_valref_data *fvd);
6765

6866
static void read_verror (const char *fmt, va_list ap)
6967
{
@@ -128,25 +126,23 @@ static void valref_validate_continuation (flux_future_t *f, void *arg)
128126
fvd->in_flight--;
129127

130128
if (fvd->index < fvd->count) {
131-
valref_validate (fvd, fvd->treeobj, fvd->index);
129+
valref_validate (fvd);
132130
fvd->in_flight++;
133131
fvd->index++;
134132
}
135133

136134
flux_future_destroy (f);
137135
}
138136

139-
static void valref_validate (struct fsck_valref_data *fvd,
140-
json_t *treeobj,
141-
int index)
137+
static void valref_validate (struct fsck_valref_data *fvd)
142138
{
143139
uint32_t hash[BLOBREF_MAX_DIGEST_SIZE];
144140
ssize_t hash_size;
145141
const char *blobref;
146142
flux_future_t *f;
147143
int *indexp;
148144

149-
blobref = treeobj_get_blobref (treeobj, index);
145+
blobref = treeobj_get_blobref (fvd->treeobj, fvd->index);
150146

151147
if ((hash_size = blobref_strtohash (blobref, hash, sizeof (hash))) < 0)
152148
log_err_exit ("cannot get hash from ref string");
@@ -161,7 +157,7 @@ static void valref_validate (struct fsck_valref_data *fvd,
161157
log_err_exit ("cannot validate valref blob");
162158
if (!(indexp = (int *)malloc (sizeof (int))))
163159
log_err_exit ("cannot allocate index memory");
164-
(*indexp) = index;
160+
(*indexp) = fvd->index;
165161
if (flux_future_aux_set (f, "index", indexp, free) < 0)
166162
log_err_exit ("could not save index value");
167163
}
@@ -334,7 +330,7 @@ static void fsck_valref (struct fsck_ctx *ctx,
334330

335331
while (fvd.in_flight < BLOBREF_ASYNC_MAX
336332
&& fvd.index < fvd.count) {
337-
valref_validate (&fvd, treeobj, fvd.index);
333+
valref_validate (&fvd);
338334
fvd.in_flight++;
339335
fvd.index++;
340336
}

0 commit comments

Comments
 (0)