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";'
This commit is contained in:
parent
91f3df3c45
commit
c1dc5d9473
25
fsck_minix.c
25
fsck_minix.c
@ -143,9 +143,10 @@ static struct termios termios;
|
|||||||
static int termios_set = 0;
|
static int termios_set = 0;
|
||||||
|
|
||||||
/* File-name data */
|
/* File-name data */
|
||||||
#define MAX_DEPTH 50
|
#define MAX_DEPTH 32
|
||||||
static int name_depth = 0;
|
static int name_depth = 0;
|
||||||
static char name_list[MAX_DEPTH][PATH_MAX + 1];
|
// static char name_list[MAX_DEPTH][PATH_MAX + 1];
|
||||||
|
static char **name_list;
|
||||||
|
|
||||||
static char *inode_buffer = NULL;
|
static char *inode_buffer = NULL;
|
||||||
|
|
||||||
@ -1240,12 +1241,32 @@ static void check2(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Wed Feb 9 15:17:06 MST 2000 */
|
||||||
|
/* dynamically allocate name_list (instead of making it static) */
|
||||||
|
static void alloc_name_list(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
name_list = malloc(sizeof(char *) * MAX_DEPTH);
|
||||||
|
for (i = 0; i < MAX_DEPTH; i++) {
|
||||||
|
name_list[i] = malloc(sizeof(char) * PATH_MAX + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void free_name_list(void)
|
||||||
|
{
|
||||||
|
if (name_list) free(name_list);
|
||||||
|
}
|
||||||
|
|
||||||
extern int fsck_minix_main(int argc, char **argv)
|
extern int fsck_minix_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct termios tmp;
|
struct termios tmp;
|
||||||
int count;
|
int count;
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
|
|
||||||
|
alloc_name_list();
|
||||||
|
atexit(free_name_list);
|
||||||
|
|
||||||
if (argc && *argv)
|
if (argc && *argv)
|
||||||
program_name = *argv;
|
program_name = *argv;
|
||||||
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
|
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
|
||||||
|
@ -143,9 +143,10 @@ static struct termios termios;
|
|||||||
static int termios_set = 0;
|
static int termios_set = 0;
|
||||||
|
|
||||||
/* File-name data */
|
/* File-name data */
|
||||||
#define MAX_DEPTH 50
|
#define MAX_DEPTH 32
|
||||||
static int name_depth = 0;
|
static int name_depth = 0;
|
||||||
static char name_list[MAX_DEPTH][PATH_MAX + 1];
|
// static char name_list[MAX_DEPTH][PATH_MAX + 1];
|
||||||
|
static char **name_list;
|
||||||
|
|
||||||
static char *inode_buffer = NULL;
|
static char *inode_buffer = NULL;
|
||||||
|
|
||||||
@ -1240,12 +1241,32 @@ static void check2(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Wed Feb 9 15:17:06 MST 2000 */
|
||||||
|
/* dynamically allocate name_list (instead of making it static) */
|
||||||
|
static void alloc_name_list(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
name_list = malloc(sizeof(char *) * MAX_DEPTH);
|
||||||
|
for (i = 0; i < MAX_DEPTH; i++) {
|
||||||
|
name_list[i] = malloc(sizeof(char) * PATH_MAX + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void free_name_list(void)
|
||||||
|
{
|
||||||
|
if (name_list) free(name_list);
|
||||||
|
}
|
||||||
|
|
||||||
extern int fsck_minix_main(int argc, char **argv)
|
extern int fsck_minix_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct termios tmp;
|
struct termios tmp;
|
||||||
int count;
|
int count;
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
|
|
||||||
|
alloc_name_list();
|
||||||
|
atexit(free_name_list);
|
||||||
|
|
||||||
if (argc && *argv)
|
if (argc && *argv)
|
||||||
program_name = *argv;
|
program_name = *argv;
|
||||||
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
|
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
|
||||||
|
Loading…
Reference in New Issue
Block a user