mirror of
https://github.com/coreutils/coreutils.git
synced 2024-11-26 11:23:47 +08:00
(adjust_blocks): Convert to a macro. The static
function wasn't always used.
This commit is contained in:
parent
14fd34b788
commit
52cafd727f
@ -56,18 +56,14 @@ int statvfs ();
|
||||
/* Return the number of TOSIZE-byte blocks used by
|
||||
BLOCKS FROMSIZE-byte blocks, rounding up. */
|
||||
|
||||
static long
|
||||
adjust_blocks (blocks, fromsize, tosize)
|
||||
long blocks;
|
||||
int fromsize, tosize;
|
||||
{
|
||||
if (fromsize == tosize) /* E.g., from 512 to 512. */
|
||||
return blocks;
|
||||
else if (fromsize > tosize) /* E.g., from 2048 to 512. */
|
||||
return blocks * (fromsize / tosize);
|
||||
else /* E.g., from 256 to 512. */
|
||||
return (blocks + 1) / (tosize / fromsize);
|
||||
}
|
||||
#define adjust_blocks(blocks, fromsize, tosize) \
|
||||
(((fromsize) == (tosize)) \
|
||||
? (blocks) /* E.g., from 512 to 512. */ \
|
||||
: (((fromsize) > (tosize)) \
|
||||
/* E.g., from 2048 to 512. */ \
|
||||
? (blocks) * ((fromsize) / (tosize)) \
|
||||
/* E.g., from 256 to 512. */ \
|
||||
: ((blocks) + 1) / ((tosize) / (fromsize))))
|
||||
|
||||
/* Fill in the fields of FSP with information about space usage for
|
||||
the filesystem on which PATH resides.
|
||||
|
Loading…
Reference in New Issue
Block a user