aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-07-25 18:01:20 +0000
committerEric Andersen <andersen@codepoet.org>2000-07-25 18:01:20 +0000
commitb040d4f3da1545225b9a58301deb29acee6aa7f3 (patch)
treef029b6d39fc4619a8369094efd4c558b10f3d927
parentb9ea02c04b91773e6e5a116313b360f3499a2d4e (diff)
downloadbusybox-w32-b040d4f3da1545225b9a58301deb29acee6aa7f3.tar.gz
busybox-w32-b040d4f3da1545225b9a58301deb29acee6aa7f3.tar.bz2
busybox-w32-b040d4f3da1545225b9a58301deb29acee6aa7f3.zip
Use BB_FEATURE_CLEAN_UP where appropriate
-Erik
-rw-r--r--cmdedit.c12
-rw-r--r--coreutils/dd.c2
-rw-r--r--dd.c2
-rw-r--r--editors/sed.c4
-rw-r--r--fsck_minix.c6
-rw-r--r--mount.c2
-rw-r--r--sed.c4
-rw-r--r--shell/cmdedit.c12
-rw-r--r--umount.c5
-rw-r--r--util-linux/fsck_minix.c6
-rw-r--r--util-linux/mount.c2
-rw-r--r--util-linux/umount.c5
12 files changed, 48 insertions, 14 deletions
diff --git a/cmdedit.c b/cmdedit.c
index 0de18e81f..0ce64beeb 100644
--- a/cmdedit.c
+++ b/cmdedit.c
@@ -115,6 +115,18 @@ void cmdedit_reset_term(void)
115 if (reset_term) 115 if (reset_term)
116 /* sparc and other have broken termios support: use old termio handling. */ 116 /* sparc and other have broken termios support: use old termio handling. */
117 setTermSettings(fileno(stdin), (void*) &initial_settings); 117 setTermSettings(fileno(stdin), (void*) &initial_settings);
118#ifdef BB_FEATURE_CLEAN_UP
119 if (his_front) {
120 struct history *n;
121 //while(his_front!=his_end) {
122 while(his_front!=his_end) {
123 n = his_front->n;
124 free(his_front->s);
125 free(his_front);
126 his_front=n;
127 }
128 }
129#endif
118} 130}
119 131
120void clean_up_and_die(int sig) 132void clean_up_and_die(int sig)
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 86899194c..6df2588ca 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -173,7 +173,7 @@ extern int dd_main(int argc, char **argv)
173 cleanup: 173 cleanup:
174 /* Note that we are not freeing memory or closing 174 /* Note that we are not freeing memory or closing
175 * files here, to save a few bytes. */ 175 * files here, to save a few bytes. */
176#if 0 176#ifdef BB_FEATURE_CLEAN_UP
177 close(inFd); 177 close(inFd);
178 close(outFd); 178 close(outFd);
179 free(buf); 179 free(buf);
diff --git a/dd.c b/dd.c
index 86899194c..6df2588ca 100644
--- a/dd.c
+++ b/dd.c
@@ -173,7 +173,7 @@ extern int dd_main(int argc, char **argv)
173 cleanup: 173 cleanup:
174 /* Note that we are not freeing memory or closing 174 /* Note that we are not freeing memory or closing
175 * files here, to save a few bytes. */ 175 * files here, to save a few bytes. */
176#if 0 176#ifdef BB_FEATURE_CLEAN_UP
177 close(inFd); 177 close(inFd);
178 close(outFd); 178 close(outFd);
179 free(buf); 179 free(buf);
diff --git a/editors/sed.c b/editors/sed.c
index b54a9bb9c..69a5e0324 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -92,7 +92,7 @@ static int ncmds = 0; /* number of sed commands */
92 92
93/*static char *cur_file = NULL;*/ /* file currently being processed XXX: do I need this? */ 93/*static char *cur_file = NULL;*/ /* file currently being processed XXX: do I need this? */
94 94
95#if 0 95#ifdef BB_FEATURE_CLEAN_UP
96static void destroy_cmd_strs() 96static void destroy_cmd_strs()
97{ 97{
98 if (sed_cmds == NULL) 98 if (sed_cmds == NULL)
@@ -663,7 +663,7 @@ extern int sed_main(int argc, char **argv)
663{ 663{
664 int opt; 664 int opt;
665 665
666#if 0 666#ifdef BB_FEATURE_CLEAN_UP
667 /* destroy command strings on exit */ 667 /* destroy command strings on exit */
668 if (atexit(destroy_cmd_strs) == -1) { 668 if (atexit(destroy_cmd_strs) == -1) {
669 perror("sed"); 669 perror("sed");
diff --git a/fsck_minix.c b/fsck_minix.c
index c3c493fd2..f980fe9ea 100644
--- a/fsck_minix.c
+++ b/fsck_minix.c
@@ -1319,7 +1319,7 @@ static void alloc_name_list(void)
1319 name_list[i] = xmalloc(sizeof(char) * BUFSIZ + 1); 1319 name_list[i] = xmalloc(sizeof(char) * BUFSIZ + 1);
1320} 1320}
1321 1321
1322#if 0 1322#ifdef BB_FEATURE_CLEAN_UP
1323/* execute this atexit() to deallocate name_list[] */ 1323/* execute this atexit() to deallocate name_list[] */
1324/* piptigger was here */ 1324/* piptigger was here */
1325static void free_name_list(void) 1325static void free_name_list(void)
@@ -1344,9 +1344,11 @@ extern int fsck_minix_main(int argc, char **argv)
1344 int retcode = 0; 1344 int retcode = 0;
1345 1345
1346 alloc_name_list(); 1346 alloc_name_list();
1347#ifdef BB_FEATURE_CLEAN_UP
1347 /* Don't bother to free memory. Exit does 1348 /* Don't bother to free memory. Exit does
1348 * that automagically, so we can save a few bytes */ 1349 * that automagically, so we can save a few bytes */
1349 //atexit(free_name_list); 1350 atexit(free_name_list);
1351#endif
1350 1352
1351 if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE) 1353 if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
1352 die("bad inode size"); 1354 die("bad inode size");
diff --git a/mount.c b/mount.c
index 610d12d34..6e95cdc79 100644
--- a/mount.c
+++ b/mount.c
@@ -347,9 +347,9 @@ extern int mount_main(int argc, char **argv)
347 mntentlist[i].mnt_opts, mntentlist[i].mnt_freq, 347 mntentlist[i].mnt_opts, mntentlist[i].mnt_freq,
348 mntentlist[i].mnt_passno); 348 mntentlist[i].mnt_passno);
349 } 349 }
350#ifdef BB_FEATURE_CLEAN_UP
350 /* Don't bother to close files or free memory. Exit 351 /* Don't bother to close files or free memory. Exit
351 * does that automagically, so we can save a few bytes */ 352 * does that automagically, so we can save a few bytes */
352#if 0
353 free( mntentlist); 353 free( mntentlist);
354 close(fd); 354 close(fd);
355#endif 355#endif
diff --git a/sed.c b/sed.c
index b54a9bb9c..69a5e0324 100644
--- a/sed.c
+++ b/sed.c
@@ -92,7 +92,7 @@ static int ncmds = 0; /* number of sed commands */
92 92
93/*static char *cur_file = NULL;*/ /* file currently being processed XXX: do I need this? */ 93/*static char *cur_file = NULL;*/ /* file currently being processed XXX: do I need this? */
94 94
95#if 0 95#ifdef BB_FEATURE_CLEAN_UP
96static void destroy_cmd_strs() 96static void destroy_cmd_strs()
97{ 97{
98 if (sed_cmds == NULL) 98 if (sed_cmds == NULL)
@@ -663,7 +663,7 @@ extern int sed_main(int argc, char **argv)
663{ 663{
664 int opt; 664 int opt;
665 665
666#if 0 666#ifdef BB_FEATURE_CLEAN_UP
667 /* destroy command strings on exit */ 667 /* destroy command strings on exit */
668 if (atexit(destroy_cmd_strs) == -1) { 668 if (atexit(destroy_cmd_strs) == -1) {
669 perror("sed"); 669 perror("sed");
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index 0de18e81f..0ce64beeb 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -115,6 +115,18 @@ void cmdedit_reset_term(void)
115 if (reset_term) 115 if (reset_term)
116 /* sparc and other have broken termios support: use old termio handling. */ 116 /* sparc and other have broken termios support: use old termio handling. */
117 setTermSettings(fileno(stdin), (void*) &initial_settings); 117 setTermSettings(fileno(stdin), (void*) &initial_settings);
118#ifdef BB_FEATURE_CLEAN_UP
119 if (his_front) {
120 struct history *n;
121 //while(his_front!=his_end) {
122 while(his_front!=his_end) {
123 n = his_front->n;
124 free(his_front->s);
125 free(his_front);
126 his_front=n;
127 }
128 }
129#endif
118} 130}
119 131
120void clean_up_and_die(int sig) 132void clean_up_and_die(int sig)
diff --git a/umount.c b/umount.c
index df075f7d9..6a5e4cad8 100644
--- a/umount.c
+++ b/umount.c
@@ -142,7 +142,7 @@ char *mtab_next(void **iter)
142 142
143/* Don't bother to clean up, since exit() does that 143/* Don't bother to clean up, since exit() does that
144 * automagically, so we can save a few bytes */ 144 * automagically, so we can save a few bytes */
145#if 0 145#ifdef BB_FEATURE_CLEAN_UP
146void mtab_free(void) 146void mtab_free(void)
147{ 147{
148 struct _mtab_entry_t *this, *next; 148 struct _mtab_entry_t *this, *next;
@@ -235,6 +235,9 @@ extern int umount_main(int argc, char **argv)
235 if (argc < 2) { 235 if (argc < 2) {
236 usage(umount_usage); 236 usage(umount_usage);
237 } 237 }
238#ifdef BB_FEATURE_CLEAN_UP
239 atexit(mtab_free);
240#endif
238 241
239 /* Parse any options */ 242 /* Parse any options */
240 while (--argc > 0 && **(++argv) == '-') { 243 while (--argc > 0 && **(++argv) == '-') {
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index c3c493fd2..f980fe9ea 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -1319,7 +1319,7 @@ static void alloc_name_list(void)
1319 name_list[i] = xmalloc(sizeof(char) * BUFSIZ + 1); 1319 name_list[i] = xmalloc(sizeof(char) * BUFSIZ + 1);
1320} 1320}
1321 1321
1322#if 0 1322#ifdef BB_FEATURE_CLEAN_UP
1323/* execute this atexit() to deallocate name_list[] */ 1323/* execute this atexit() to deallocate name_list[] */
1324/* piptigger was here */ 1324/* piptigger was here */
1325static void free_name_list(void) 1325static void free_name_list(void)
@@ -1344,9 +1344,11 @@ extern int fsck_minix_main(int argc, char **argv)
1344 int retcode = 0; 1344 int retcode = 0;
1345 1345
1346 alloc_name_list(); 1346 alloc_name_list();
1347#ifdef BB_FEATURE_CLEAN_UP
1347 /* Don't bother to free memory. Exit does 1348 /* Don't bother to free memory. Exit does
1348 * that automagically, so we can save a few bytes */ 1349 * that automagically, so we can save a few bytes */
1349 //atexit(free_name_list); 1350 atexit(free_name_list);
1351#endif
1350 1352
1351 if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE) 1353 if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
1352 die("bad inode size"); 1354 die("bad inode size");
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 610d12d34..6e95cdc79 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -347,9 +347,9 @@ extern int mount_main(int argc, char **argv)
347 mntentlist[i].mnt_opts, mntentlist[i].mnt_freq, 347 mntentlist[i].mnt_opts, mntentlist[i].mnt_freq,
348 mntentlist[i].mnt_passno); 348 mntentlist[i].mnt_passno);
349 } 349 }
350#ifdef BB_FEATURE_CLEAN_UP
350 /* Don't bother to close files or free memory. Exit 351 /* Don't bother to close files or free memory. Exit
351 * does that automagically, so we can save a few bytes */ 352 * does that automagically, so we can save a few bytes */
352#if 0
353 free( mntentlist); 353 free( mntentlist);
354 close(fd); 354 close(fd);
355#endif 355#endif
diff --git a/util-linux/umount.c b/util-linux/umount.c
index df075f7d9..6a5e4cad8 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -142,7 +142,7 @@ char *mtab_next(void **iter)
142 142
143/* Don't bother to clean up, since exit() does that 143/* Don't bother to clean up, since exit() does that
144 * automagically, so we can save a few bytes */ 144 * automagically, so we can save a few bytes */
145#if 0 145#ifdef BB_FEATURE_CLEAN_UP
146void mtab_free(void) 146void mtab_free(void)
147{ 147{
148 struct _mtab_entry_t *this, *next; 148 struct _mtab_entry_t *this, *next;
@@ -235,6 +235,9 @@ extern int umount_main(int argc, char **argv)
235 if (argc < 2) { 235 if (argc < 2) {
236 usage(umount_usage); 236 usage(umount_usage);
237 } 237 }
238#ifdef BB_FEATURE_CLEAN_UP
239 atexit(mtab_free);
240#endif
238 241
239 /* Parse any options */ 242 /* Parse any options */
240 while (--argc > 0 && **(++argv) == '-') { 243 while (--argc > 0 && **(++argv) == '-') {