if (reset_term)
/* sparc and other have broken termios support: use old termio handling. */
setTermSettings(fileno(stdin), (void*) &initial_settings);
+#ifdef BB_FEATURE_CLEAN_UP
+ if (his_front) {
+ struct history *n;
+ //while(his_front!=his_end) {
+ while(his_front!=his_end) {
+ n = his_front->n;
+ free(his_front->s);
+ free(his_front);
+ his_front=n;
+ }
+ }
+#endif
}
void clean_up_and_die(int sig)
cleanup:
/* Note that we are not freeing memory or closing
* files here, to save a few bytes. */
-#if 0
+#ifdef BB_FEATURE_CLEAN_UP
close(inFd);
close(outFd);
free(buf);
cleanup:
/* Note that we are not freeing memory or closing
* files here, to save a few bytes. */
-#if 0
+#ifdef BB_FEATURE_CLEAN_UP
close(inFd);
close(outFd);
free(buf);
/*static char *cur_file = NULL;*/ /* file currently being processed XXX: do I need this? */
-#if 0
+#ifdef BB_FEATURE_CLEAN_UP
static void destroy_cmd_strs()
{
if (sed_cmds == NULL)
{
int opt;
-#if 0
+#ifdef BB_FEATURE_CLEAN_UP
/* destroy command strings on exit */
if (atexit(destroy_cmd_strs) == -1) {
perror("sed");
name_list[i] = xmalloc(sizeof(char) * BUFSIZ + 1);
}
-#if 0
+#ifdef BB_FEATURE_CLEAN_UP
/* execute this atexit() to deallocate name_list[] */
/* piptigger was here */
static void free_name_list(void)
int retcode = 0;
alloc_name_list();
+#ifdef BB_FEATURE_CLEAN_UP
/* Don't bother to free memory. Exit does
* that automagically, so we can save a few bytes */
- //atexit(free_name_list);
+ atexit(free_name_list);
+#endif
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
die("bad inode size");
mntentlist[i].mnt_opts, mntentlist[i].mnt_freq,
mntentlist[i].mnt_passno);
}
+#ifdef BB_FEATURE_CLEAN_UP
/* Don't bother to close files or free memory. Exit
* does that automagically, so we can save a few bytes */
-#if 0
free( mntentlist);
close(fd);
#endif
/*static char *cur_file = NULL;*/ /* file currently being processed XXX: do I need this? */
-#if 0
+#ifdef BB_FEATURE_CLEAN_UP
static void destroy_cmd_strs()
{
if (sed_cmds == NULL)
{
int opt;
-#if 0
+#ifdef BB_FEATURE_CLEAN_UP
/* destroy command strings on exit */
if (atexit(destroy_cmd_strs) == -1) {
perror("sed");
if (reset_term)
/* sparc and other have broken termios support: use old termio handling. */
setTermSettings(fileno(stdin), (void*) &initial_settings);
+#ifdef BB_FEATURE_CLEAN_UP
+ if (his_front) {
+ struct history *n;
+ //while(his_front!=his_end) {
+ while(his_front!=his_end) {
+ n = his_front->n;
+ free(his_front->s);
+ free(his_front);
+ his_front=n;
+ }
+ }
+#endif
}
void clean_up_and_die(int sig)
/* Don't bother to clean up, since exit() does that
* automagically, so we can save a few bytes */
-#if 0
+#ifdef BB_FEATURE_CLEAN_UP
void mtab_free(void)
{
struct _mtab_entry_t *this, *next;
if (argc < 2) {
usage(umount_usage);
}
+#ifdef BB_FEATURE_CLEAN_UP
+ atexit(mtab_free);
+#endif
/* Parse any options */
while (--argc > 0 && **(++argv) == '-') {
name_list[i] = xmalloc(sizeof(char) * BUFSIZ + 1);
}
-#if 0
+#ifdef BB_FEATURE_CLEAN_UP
/* execute this atexit() to deallocate name_list[] */
/* piptigger was here */
static void free_name_list(void)
int retcode = 0;
alloc_name_list();
+#ifdef BB_FEATURE_CLEAN_UP
/* Don't bother to free memory. Exit does
* that automagically, so we can save a few bytes */
- //atexit(free_name_list);
+ atexit(free_name_list);
+#endif
if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
die("bad inode size");
mntentlist[i].mnt_opts, mntentlist[i].mnt_freq,
mntentlist[i].mnt_passno);
}
+#ifdef BB_FEATURE_CLEAN_UP
/* Don't bother to close files or free memory. Exit
* does that automagically, so we can save a few bytes */
-#if 0
free( mntentlist);
close(fd);
#endif
/* Don't bother to clean up, since exit() does that
* automagically, so we can save a few bytes */
-#if 0
+#ifdef BB_FEATURE_CLEAN_UP
void mtab_free(void)
{
struct _mtab_entry_t *this, *next;
if (argc < 2) {
usage(umount_usage);
}
+#ifdef BB_FEATURE_CLEAN_UP
+ atexit(mtab_free);
+#endif
/* Parse any options */
while (--argc > 0 && **(++argv) == '-') {