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 84f5d02b7..fddcc7653 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 */ | |||
321 | #define WARN(msg) {fprintf msg ; \ | 321 | #define WARN(msg) {fprintf msg ; \ |
322 | if (exit_code == OK) exit_code = WARNING;} | 322 | if (exit_code == OK) exit_code = WARNING;} |
323 | 323 | ||
324 | #define do_exit(c) exit(c) | ||
325 | |||
326 | |||
324 | /* in unzip.c */ | 327 | /* in unzip.c */ |
325 | extern int unzip OF((int in, int out)); | 328 | extern int unzip OF((int in, int out)); |
326 | 329 | ||
@@ -359,7 +362,6 @@ extern void error OF((char *m)); | |||
359 | extern void warn OF((char *a, char *b)); | 362 | extern void warn OF((char *a, char *b)); |
360 | extern void read_error OF((void)); | 363 | extern void read_error OF((void)); |
361 | extern void write_error OF((void)); | 364 | extern void write_error OF((void)); |
362 | extern voidp xmalloc OF((unsigned int size)); | ||
363 | 365 | ||
364 | /* in inflate.c */ | 366 | /* in inflate.c */ |
365 | extern int inflate OF((void)); | 367 | extern int inflate OF((void)); |
@@ -679,7 +681,6 @@ long header_bytes; /* number of bytes in gzip header */ | |||
679 | /* local functions */ | 681 | /* local functions */ |
680 | 682 | ||
681 | local int get_method OF((int in)); | 683 | local int get_method OF((int in)); |
682 | local void do_exit(int exitcode) __attribute__ ((noreturn)); | ||
683 | 684 | ||
684 | #define strequ(s1, s2) (strcmp((s1),(s2)) == 0) | 685 | #define strequ(s1, s2) (strcmp((s1),(s2)) == 0) |
685 | 686 | ||
@@ -927,30 +928,6 @@ local int get_method(in) | |||
927 | } | 928 | } |
928 | } | 929 | } |
929 | 930 | ||
930 | |||
931 | /* ======================================================================== | ||
932 | * Free all dynamically allocated variables and exit with the given code. | ||
933 | */ | ||
934 | local void do_exit(exitcode) | ||
935 | int exitcode; | ||
936 | { | ||
937 | static int in_exit = 0; | ||
938 | |||
939 | if (in_exit) exit(exitcode); | ||
940 | in_exit = 1; | ||
941 | FREE(inbuf); | ||
942 | FREE(outbuf); | ||
943 | FREE(d_buf); | ||
944 | FREE(window); | ||
945 | #ifndef MAXSEG_64K | ||
946 | FREE(tab_prefix); | ||
947 | #else | ||
948 | FREE(tab_prefix0); | ||
949 | FREE(tab_prefix1); | ||
950 | #endif | ||
951 | exit(exitcode); | ||
952 | } | ||
953 | |||
954 | /* ======================================================================== | 931 | /* ======================================================================== |
955 | * Signal and error handler. | 932 | * Signal and error handler. |
956 | */ | 933 | */ |
@@ -1284,13 +1261,6 @@ int strcspn(s, reject) | |||
1284 | /* ======================================================================== | 1261 | /* ======================================================================== |
1285 | * Error handlers. | 1262 | * Error handlers. |
1286 | */ | 1263 | */ |
1287 | void error(m) | ||
1288 | char *m; | ||
1289 | { | ||
1290 | fprintf(stderr, "\n%s\n", m); | ||
1291 | abort_gzip(); | ||
1292 | } | ||
1293 | |||
1294 | void warn(a, b) | 1264 | void warn(a, b) |
1295 | char *a, *b; /* message strings juxtaposed in output */ | 1265 | char *a, *b; /* message strings juxtaposed in output */ |
1296 | { | 1266 | { |
@@ -1317,18 +1287,6 @@ void write_error() | |||
1317 | 1287 | ||
1318 | 1288 | ||
1319 | /* ======================================================================== | 1289 | /* ======================================================================== |
1320 | * Semi-safe malloc -- never returns NULL. | ||
1321 | */ | ||
1322 | voidp xmalloc (size) | ||
1323 | unsigned size; | ||
1324 | { | ||
1325 | voidp cp = (voidp)malloc (size); | ||
1326 | |||
1327 | if (cp == NULL) error("out of memory"); | ||
1328 | return cp; | ||
1329 | } | ||
1330 | |||
1331 | /* ======================================================================== | ||
1332 | * Table of CRC-32's of all single-byte values (made by makecrc.c) | 1290 | * Table of CRC-32's of all single-byte values (made by makecrc.c) |
1333 | */ | 1291 | */ |
1334 | static const ulg crc_32_tab[] = { | 1292 | static const ulg crc_32_tab[] = { |
diff --git a/archival/gzip.c b/archival/gzip.c index 76df3ad9a..3438ee42f 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 */ | |||
277 | #define WARN(msg) {if (!quiet) fprintf msg ; \ | 277 | #define WARN(msg) {if (!quiet) fprintf msg ; \ |
278 | if (exit_code == OK) exit_code = WARNING;} | 278 | if (exit_code == OK) exit_code = WARNING;} |
279 | 279 | ||
280 | local void do_exit(int exitcode) __attribute__ ((noreturn)); | 280 | #define do_exit(c) exit(c) |
281 | |||
281 | 282 | ||
282 | /* in zip.c: */ | 283 | /* in zip.c: */ |
283 | extern int zip OF((int in, int out)); | 284 | extern int zip OF((int in, int out)); |
@@ -328,7 +329,6 @@ extern void warn OF((char *a, char *b)); | |||
328 | extern void read_error OF((void)); | 329 | extern void read_error OF((void)); |
329 | extern void write_error OF((void)); | 330 | extern void write_error OF((void)); |
330 | extern void display_ratio OF((long num, long den, FILE *file)); | 331 | extern void display_ratio OF((long num, long den, FILE *file)); |
331 | extern voidp xmalloc OF((unsigned int size)); | ||
332 | 332 | ||
333 | /* in inflate.c */ | 333 | /* in inflate.c */ |
334 | extern int inflate OF((void)); | 334 | extern int inflate OF((void)); |
@@ -1912,29 +1912,6 @@ int gzip_main(int argc, char ** argv) | |||
1912 | do_exit(exit_code); | 1912 | do_exit(exit_code); |
1913 | } | 1913 | } |
1914 | 1914 | ||
1915 | /* ======================================================================== | ||
1916 | * Free all dynamically allocated variables and exit with the given code. | ||
1917 | */ | ||
1918 | local void do_exit(int exitcode) | ||
1919 | { | ||
1920 | static int in_exit = 0; | ||
1921 | |||
1922 | if (in_exit) exit(exitcode); | ||
1923 | in_exit = 1; | ||
1924 | if (env != NULL) free(env), env = NULL; | ||
1925 | if (args != NULL) free((char*)args), args = NULL; | ||
1926 | FREE(inbuf); | ||
1927 | FREE(outbuf); | ||
1928 | FREE(d_buf); | ||
1929 | FREE(window); | ||
1930 | #ifndef MAXSEG_64K | ||
1931 | FREE(tab_prefix); | ||
1932 | #else | ||
1933 | FREE(tab_prefix0); | ||
1934 | FREE(tab_prefix1); | ||
1935 | #endif | ||
1936 | exit(exitcode); | ||
1937 | } | ||
1938 | /* trees.c -- output deflated data using Huffman coding | 1915 | /* trees.c -- output deflated data using Huffman coding |
1939 | * Copyright (C) 1992-1993 Jean-loup Gailly | 1916 | * Copyright (C) 1992-1993 Jean-loup Gailly |
1940 | * This is free software; you can redistribute it and/or modify it under the | 1917 | * This is free software; you can redistribute it and/or modify it under the |