diff options
author | Jim Meyering <jim@meyering.net> | 1992-10-31 22:50:51 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1992-10-31 22:50:51 +0000 |
commit | b01778752f699303762e2307867d462133ae2b1a (patch) | |
tree | 54dda79e1f93a97b07e4155d5bd4c5481982c92e | |
parent | d87c39464604e74f580c7fae835be31a4c125c36 (diff) | |
download | gnulib-b01778752f699303762e2307867d462133ae2b1a.tar.gz |
(adjust_blocks): Convert to a macro. The static
function wasn't always used.
-rw-r--r-- | lib/fsusage.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/fsusage.c b/lib/fsusage.c index b434913439..8cc0c6d733 100644 --- a/lib/fsusage.c +++ b/lib/fsusage.c @@ -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. |