From ec4f3d95e7f0150f92e046bf65d4d63fbeffb528 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 17 Dec 2004 05:23:36 +0000 Subject: [PATCH] Minor in-passing crapectomy. --- archival/gzip.c | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/archival/gzip.c b/archival/gzip.c index d494aa3..e539c2a 100644 --- a/archival/gzip.c +++ b/archival/gzip.c @@ -51,12 +51,6 @@ #include #include "busybox.h" -#define memzero(s, n) memset ((void *)(s), 0, (n)) - -#ifndef RETSIGTYPE -# define RETSIGTYPE void -#endif - typedef unsigned char uch; typedef unsigned short ush; typedef unsigned long ulg; @@ -214,9 +208,6 @@ typedef int file_t; /* Do not use stdio */ static int zip(int in, int out); static int file_read(char *buf, unsigned size); - /* from gzip.c */ -static RETSIGTYPE abort_gzip(void); - /* from deflate.c */ static void lm_init(ush * flags); static ulg deflate(void); @@ -335,7 +326,7 @@ static void put_short(ush w) /* ======================================================================== * Signal and error handler. */ -static void abort_gzip() +static void abort_gzip(int ignored) { exit(ERROR); } @@ -350,13 +341,6 @@ static void clear_bufs(void) bytes_in = 0L; } -static void write_bb_error_msg(void) -{ - fputc('\n', stderr); - bb_perror_nomsg(); - abort_gzip(); -} - /* =========================================================================== * Does the same as write(), but also handles partial pipe writes and checks * for error return. @@ -366,9 +350,7 @@ static void write_buf(int fd, void *buf, unsigned cnt) unsigned n; while ((n = write(fd, buf, cnt)) != cnt) { - if (n == (unsigned) (-1)) { - write_bb_error_msg(); - } + if (n == (unsigned) (-1)) bb_error_msg_and_die("can't write"); cnt -= n; buf = (void *) ((char *) buf + n); } @@ -846,7 +828,7 @@ static void lm_init(ush * flags) register unsigned j; /* Initialize the hash table. */ - memzero((char *) head, HASH_SIZE * sizeof(*head)); + memset(head, 0, HASH_SIZE * sizeof(*head)); /* prev will be initialized on the fly */ *flags |= SLOW; @@ -1188,8 +1170,6 @@ static ulg deflate() typedef struct dirent dir_type; -typedef RETSIGTYPE(*sig_type) (int); - /* ======================================================================== */ int gzip_main(int argc, char **argv) { @@ -1235,16 +1215,16 @@ int gzip_main(int argc, char **argv) foreground = signal(SIGINT, SIG_IGN) != SIG_IGN; if (foreground) { - (void) signal(SIGINT, (sig_type) abort_gzip); + (void) signal(SIGINT, abort_gzip); } #ifdef SIGTERM if (signal(SIGTERM, SIG_IGN) != SIG_IGN) { - (void) signal(SIGTERM, (sig_type) abort_gzip); + (void) signal(SIGTERM, abort_gzip); } #endif #ifdef SIGHUP if (signal(SIGHUP, SIG_IGN) != SIG_IGN) { - (void) signal(SIGHUP, (sig_type) abort_gzip); + (void) signal(SIGHUP, abort_gzip); } #endif -- 2.7.4