Mercurial > hg > octave-lojdl > gnulib-hg
comparison lib/fsusage.c @ 7:2d78b0003b93
(adjust_blocks): Convert to a macro. The static
function wasn't always used.
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Sat, 31 Oct 1992 22:50:51 +0000 |
parents | 41c9d08b09d7 |
children | df153a752270 |
comparison
equal
deleted
inserted
replaced
5:41c9d08b09d7 | 7:2d78b0003b93 |
---|---|
54 #endif | 54 #endif |
55 | 55 |
56 /* Return the number of TOSIZE-byte blocks used by | 56 /* Return the number of TOSIZE-byte blocks used by |
57 BLOCKS FROMSIZE-byte blocks, rounding up. */ | 57 BLOCKS FROMSIZE-byte blocks, rounding up. */ |
58 | 58 |
59 static long | 59 #define adjust_blocks(blocks, fromsize, tosize) \ |
60 adjust_blocks (blocks, fromsize, tosize) | 60 (((fromsize) == (tosize)) \ |
61 long blocks; | 61 ? (blocks) /* E.g., from 512 to 512. */ \ |
62 int fromsize, tosize; | 62 : (((fromsize) > (tosize)) \ |
63 { | 63 /* E.g., from 2048 to 512. */ \ |
64 if (fromsize == tosize) /* E.g., from 512 to 512. */ | 64 ? (blocks) * ((fromsize) / (tosize)) \ |
65 return blocks; | 65 /* E.g., from 256 to 512. */ \ |
66 else if (fromsize > tosize) /* E.g., from 2048 to 512. */ | 66 : ((blocks) + 1) / ((tosize) / (fromsize)))) |
67 return blocks * (fromsize / tosize); | |
68 else /* E.g., from 256 to 512. */ | |
69 return (blocks + 1) / (tosize / fromsize); | |
70 } | |
71 | 67 |
72 /* Fill in the fields of FSP with information about space usage for | 68 /* Fill in the fields of FSP with information about space usage for |
73 the filesystem on which PATH resides. | 69 the filesystem on which PATH resides. |
74 DISK is the device on which PATH is mounted, for space-getting | 70 DISK is the device on which PATH is mounted, for space-getting |
75 methods that need to know it. | 71 methods that need to know it. |