From 6e4fb64e6141727b8144bb77265bf0a4a8450a39 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 9 Sep 1998 05:57:34 +0000 Subject: [PATCH] added finddead target, removed dead code and made some functions static --- Makefile.in | 8 ++++++++ authenticate.c | 2 +- flist.c | 2 +- io.c | 2 +- main.c | 2 +- md4.c | 2 +- token.c | 3 +-- util.c | 10 +--------- 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Makefile.in b/Makefile.in index fb9956b8..9575e74a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -60,3 +60,11 @@ proto: clean: rm -f *~ $(OBJS) rsync config.cache config.log config.status + +# this target is really just for my use. It only works on a limited +# range of machines and is used to produce a list of potentially +# dead (ie. unused) functions in the code. (tridge) +finddead: + nm *.o */*.o |grep 'U ' | awk '{print $$2}' | sort -u > nmused.txt + nm *.o */*.o |grep 'T ' | awk '{print $$3}' | sort -u > nmfns.txt + comm -13 nmused.txt nmfns.txt diff --git a/authenticate.c b/authenticate.c index 0ff318b9..5ecce15f 100644 --- a/authenticate.c +++ b/authenticate.c @@ -112,7 +112,7 @@ static int get_secret(int module, char *user, char *secret, int len) } /* generate a 16 byte hash from a password and challenge */ -void generate_hash(char *in, char *challenge, char *out) +static void generate_hash(char *in, char *challenge, char *out) { char buf[16]; diff --git a/flist.c b/flist.c index 406a5f44..693e900e 100644 --- a/flist.c +++ b/flist.c @@ -94,7 +94,7 @@ static void send_directory(int f,struct file_list *flist,char *dir); static char *flist_dir; -void send_file_entry(struct file_struct *file,int f,unsigned base_flags) +static void send_file_entry(struct file_struct *file,int f,unsigned base_flags) { unsigned char flags; static time_t last_time; diff --git a/io.c b/io.c index 0f8ab919..5122a2a2 100644 --- a/io.c +++ b/io.c @@ -484,7 +484,7 @@ void write_buf(int f,char *buf,int len) } /* write a string to the connection */ -void write_sbuf(int f,char *buf) +static void write_sbuf(int f,char *buf) { write_buf(f, buf, strlen(buf)); } diff --git a/main.c b/main.c index a2df9304..c87dd7be 100644 --- a/main.c +++ b/main.c @@ -544,7 +544,7 @@ static int start_client(int argc, char *argv[]) } -RETSIGTYPE sigusr1_handler(int val) { +static RETSIGTYPE sigusr1_handler(int val) { exit_cleanup(1); } diff --git a/md4.c b/md4.c index a12a5ded..0ab25013 100644 --- a/md4.c +++ b/md4.c @@ -102,7 +102,7 @@ ** Assumes X is an array of 16 ints. ** The macro revx reverses the byte-ordering of the next word of X. */ - void MDreverse(X) +static void MDreverse(X) unsigned int32 *X; { register unsigned int32 t; register unsigned int i; diff --git a/token.c b/token.c index 8295cc5e..1244b2d6 100644 --- a/token.c +++ b/token.c @@ -366,8 +366,7 @@ recv_deflated_token(int f, char **data) * put the data corresponding to a token that we've just returned * from recv_deflated_token into the decompressor's history buffer. */ -void -see_deflate_token(char *buf, int len) +static void see_deflate_token(char *buf, int len) { int r, blklen; unsigned char hdr[5]; diff --git a/util.c b/util.c index 70743a66..8b36474e 100644 --- a/util.c +++ b/util.c @@ -253,7 +253,7 @@ static int full_write(int desc, char *ptr, int len) for an error. derived from GNU C's cccp.c. */ -int safe_read(int desc, char *ptr, int len) +static int safe_read(int desc, char *ptr, int len) { int n_chars; @@ -410,14 +410,6 @@ int name_to_gid(char *name, gid_t *gid) } -/**************************************************************************** -check if a process exists. -****************************************************************************/ -int process_exists(int pid) -{ - return(kill(pid,0) == 0 || errno != ESRCH); -} - /* lock a byte range in a open file */ int lock_range(int fd, int offset, int len) { -- 2.34.1