Skip to content

Commit d119d53

Browse files
authored
removed redundant extra object lsize (#6963)
* removed redundant extra object lsize * removed unnecessary casts
1 parent b0ef41e commit d119d53

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/fread.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,11 +405,10 @@ double wallclock(void)
405405
* multiple threads at the same time, or hold on to the value returned for
406406
* extended periods of time.
407407
*/
408-
static const char* filesize_to_str(size_t fsize)
408+
static const char* filesize_to_str(const size_t fsize)
409409
{
410410
static const char suffixes[] = {'T', 'G', 'M', 'K'};
411411
static char output[100];
412-
size_t lsize = fsize;
413412
for (int i = 0; i <= sizeof(suffixes); i++) {
414413
int shift = (sizeof(suffixes) - i) * 10;
415414
if ((fsize >> shift) == 0) continue;
@@ -420,17 +419,17 @@ static const char* filesize_to_str(size_t fsize)
420419
if (ndigits == 0 || (fsize == (fsize >> shift << shift))) {
421420
if (i < sizeof(suffixes)) {
422421
snprintf(output, sizeof(output), "%"PRIu64"%cB (%"PRIu64" bytes)", // # notranslate
423-
(uint64_t)(lsize >> shift), suffixes[i], (uint64_t)lsize);
422+
(fsize >> shift), suffixes[i], fsize);
424423
return output;
425424
}
426425
} else {
427426
snprintf(output, sizeof(output), "%.*f%cB (%"PRIu64" bytes)", // # notranslate
428-
ndigits, (double)fsize / (1LL << shift), suffixes[i], (uint64_t)lsize);
427+
ndigits, (double)fsize / (1LL << shift), suffixes[i], fsize);
429428
return output;
430429
}
431430
}
432431
if (fsize == 1) return "1 byte";
433-
snprintf(output, sizeof(output), "%"PRIu64" bytes", (uint64_t)lsize); // # notranslate
432+
snprintf(output, sizeof(output), "%"PRIu64" bytes", fsize); // # notranslate
434433
return output;
435434
}
436435

0 commit comments

Comments
 (0)