diff options
author | John Beppu <beppu@lbox.org> | 2000-02-11 12:43:20 +0000 |
---|---|---|
committer | John Beppu <beppu@lbox.org> | 2000-02-11 12:43:20 +0000 |
commit | c1dc5d947384a338d7630e035c42a76c43eeb340 (patch) | |
tree | 23323c137ee0ae33bdecae76c9a32e47541a2191 /util-linux/fsck_minix.c | |
parent | 91f3df3c4523e70946396cefef96ac051e639132 (diff) | |
download | busybox-w32-c1dc5d947384a338d7630e035c42a76c43eeb340.tar.gz busybox-w32-c1dc5d947384a338d7630e035c42a76c43eeb340.tar.bz2 busybox-w32-c1dc5d947384a338d7630e035c42a76c43eeb340.zip |
reduced .bss size by dynmaically allocating a certain large
array instead of letting it be static.
objdump -t busybox \
| grep .bss \
| sed 's/^.*\.bss //' \
| grep -v ABS \
#| perl -e 'while(<>) { @x = split; @y = reverse split(//, $x[0]); for ($i=0; $i<@y; $i++) { $s += $y[$i] * (16 ** $i); if ($y[$i] && $i > 2) { print "> $y[$i] * 16 ** $i $x[1]\n"; } } } print "$s\n";'
Diffstat (limited to 'util-linux/fsck_minix.c')
-rw-r--r-- | util-linux/fsck_minix.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index 084c76d36..9da79748f 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c | |||
@@ -143,9 +143,10 @@ static struct termios termios; | |||
143 | static int termios_set = 0; | 143 | static int termios_set = 0; |
144 | 144 | ||
145 | /* File-name data */ | 145 | /* File-name data */ |
146 | #define MAX_DEPTH 50 | 146 | #define MAX_DEPTH 32 |
147 | static int name_depth = 0; | 147 | static int name_depth = 0; |
148 | static char name_list[MAX_DEPTH][PATH_MAX + 1]; | 148 | // static char name_list[MAX_DEPTH][PATH_MAX + 1]; |
149 | static char **name_list; | ||
149 | 150 | ||
150 | static char *inode_buffer = NULL; | 151 | static char *inode_buffer = NULL; |
151 | 152 | ||
@@ -1240,12 +1241,32 @@ static void check2(void) | |||
1240 | } | 1241 | } |
1241 | #endif | 1242 | #endif |
1242 | 1243 | ||
1244 | /* Wed Feb 9 15:17:06 MST 2000 */ | ||
1245 | /* dynamically allocate name_list (instead of making it static) */ | ||
1246 | static void alloc_name_list(void) | ||
1247 | { | ||
1248 | int i; | ||
1249 | |||
1250 | name_list = malloc(sizeof(char *) * MAX_DEPTH); | ||
1251 | for (i = 0; i < MAX_DEPTH; i++) { | ||
1252 | name_list[i] = malloc(sizeof(char) * PATH_MAX + 1); | ||
1253 | } | ||
1254 | } | ||
1255 | |||
1256 | static void free_name_list(void) | ||
1257 | { | ||
1258 | if (name_list) free(name_list); | ||
1259 | } | ||
1260 | |||
1243 | extern int fsck_minix_main(int argc, char **argv) | 1261 | extern int fsck_minix_main(int argc, char **argv) |
1244 | { | 1262 | { |
1245 | struct termios tmp; | 1263 | struct termios tmp; |
1246 | int count; | 1264 | int count; |
1247 | int retcode = 0; | 1265 | int retcode = 0; |
1248 | 1266 | ||
1267 | alloc_name_list(); | ||
1268 | atexit(free_name_list); | ||
1269 | |||
1249 | if (argc && *argv) | 1270 | if (argc && *argv) |
1250 | program_name = *argv; | 1271 | program_name = *argv; |
1251 | if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE) | 1272 | if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE) |