diff options
Diffstat (limited to 'archival')
-rw-r--r-- | archival/gunzip.c | 48 | ||||
-rw-r--r-- | archival/gzip.c | 27 |
2 files changed, 5 insertions, 70 deletions
diff --git a/archival/gunzip.c b/archival/gunzip.c index 84f5d02..fddcc76 100644 --- a/archival/gunzip.c +++ b/archival/gunzip.c @@ -321,6 +321,9 @@ extern int save_orig_name; /* set if original name must be saved */ #define WARN(msg) {fprintf msg ; \ if (exit_code == OK) exit_code = WARNING;} +#define do_exit(c) exit(c) + + /* in unzip.c */ extern int unzip OF((int in, int out)); @@ -359,7 +362,6 @@ extern void error OF((char *m)); extern void warn OF((char *a, char *b)); extern void read_error OF((void)); extern void write_error OF((void)); -extern voidp xmalloc OF((unsigned int size)); /* in inflate.c */ extern int inflate OF((void)); @@ -679,7 +681,6 @@ long header_bytes; /* number of bytes in gzip header */ /* local functions */ local int get_method OF((int in)); -local void do_exit(int exitcode) __attribute__ ((noreturn)); #define strequ(s1, s2) (strcmp((s1),(s2)) == 0) @@ -927,30 +928,6 @@ local int get_method(in) } } - -/* ======================================================================== - * Free all dynamically allocated variables and exit with the given code. - */ -local void do_exit(exitcode) - int exitcode; -{ - static int in_exit = 0; - - if (in_exit) exit(exitcode); - in_exit = 1; - FREE(inbuf); - FREE(outbuf); - FREE(d_buf); - FREE(window); -#ifndef MAXSEG_64K - FREE(tab_prefix); -#else - FREE(tab_prefix0); - FREE(tab_prefix1); -#endif - exit(exitcode); -} - /* ======================================================================== * Signal and error handler. */ @@ -1284,13 +1261,6 @@ int strcspn(s, reject) /* ======================================================================== * Error handlers. */ -void error(m) - char *m; -{ - fprintf(stderr, "\n%s\n", m); - abort_gzip(); -} - void warn(a, b) char *a, *b; /* message strings juxtaposed in output */ { @@ -1317,18 +1287,6 @@ void write_error() /* ======================================================================== - * Semi-safe malloc -- never returns NULL. - */ -voidp xmalloc (size) - unsigned size; -{ - voidp cp = (voidp)malloc (size); - - if (cp == NULL) error("out of memory"); - return cp; -} - -/* ======================================================================== * Table of CRC-32's of all single-byte values (made by makecrc.c) */ static const ulg crc_32_tab[] = { diff --git a/archival/gzip.c b/archival/gzip.c index 76df3ad..3438ee4 100644 --- a/archival/gzip.c +++ b/archival/gzip.c @@ -277,7 +277,8 @@ extern int save_orig_name; /* set if original name must be saved */ #define WARN(msg) {if (!quiet) fprintf msg ; \ if (exit_code == OK) exit_code = WARNING;} -local void do_exit(int exitcode) __attribute__ ((noreturn)); +#define do_exit(c) exit(c) + /* in zip.c: */ extern int zip OF((int in, int out)); @@ -328,7 +329,6 @@ extern void warn OF((char *a, char *b)); extern void read_error OF((void)); extern void write_error OF((void)); extern void display_ratio OF((long num, long den, FILE *file)); -extern voidp xmalloc OF((unsigned int size)); /* in inflate.c */ extern int inflate OF((void)); @@ -1912,29 +1912,6 @@ int gzip_main(int argc, char ** argv) do_exit(exit_code); } -/* ======================================================================== - * Free all dynamically allocated variables and exit with the given code. - */ -local void do_exit(int exitcode) -{ - static int in_exit = 0; - - if (in_exit) exit(exitcode); - in_exit = 1; - if (env != NULL) free(env), env = NULL; - if (args != NULL) free((char*)args), args = NULL; - FREE(inbuf); - FREE(outbuf); - FREE(d_buf); - FREE(window); -#ifndef MAXSEG_64K - FREE(tab_prefix); -#else - FREE(tab_prefix0); - FREE(tab_prefix1); -#endif - exit(exitcode); -} /* trees.c -- output deflated data using Huffman coding * Copyright (C) 1992-1993 Jean-loup Gailly * This is free software; you can redistribute it and/or modify it under the |