From b988e451f135dd3b023c6b6c9004b85dc0c857b5 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 13 Sep 2003 01:47:36 +0000 Subject: [PATCH] gcc -Wall cleanup. --- Makefile | 2 +- main.c | 8 ++++---- report.c | 6 ++---- shred.h | 1 + shredtree.c | 5 +++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 516d6c7..7aec63a 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ DOCS = README NEWS comparator.xml scf-standard.xml COPYING EXTRAS = shredtree.py shredcompare.py TEST = test SOURCES = $(CODE) $(DOCS) $(EXTRAS) $(TEST) comparator.spec Makefile -CFLAGS = -O +CFLAGS = -O -Wall LDFLAGS = all: comparator comparator.1 diff --git a/main.c b/main.c index 270a6c3..ad9dcc5 100644 --- a/main.c +++ b/main.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "shred.h" int debug = 0; @@ -98,7 +99,7 @@ static void write_scf(const char *tree, FILE *ofp) { char **place, **list; int file_count, progress, totalchunks; - u_int32_t netfile_count, lines, totallines = 0; + u_int32_t netfile_count, totallines = 0; char buf[BUFSIZ]; list = sorted_file_list(tree, &file_count); @@ -194,7 +195,7 @@ static void write_scf(const char *tree, FILE *ofp) static void read_scf(struct scf_t *scf) /* merge hashes from specified files into an in-code list */ { - u_int32_t filecount, totallines; + u_int32_t filecount; int hashcount = 0; struct stat sb; @@ -414,7 +415,6 @@ main(int argc, char *argv[]) int status, file_only, compile_only, argcount; struct scf_t *scf; char *dir, *outfile; - struct sorthash_t *np; compile_only = file_only = 0; dir = outfile = NULL; @@ -490,7 +490,7 @@ main(int argc, char *argv[]) /* two or more arguments */ for(; optind < argc; optind++) { - char *olddir, *source = argv[optind]; + char *olddir = NULL, *source = argv[optind]; scf = (struct scf_t *)calloc(sizeof(struct scf_t), 1); scf->next = scflist; diff --git a/report.c b/report.c index b7f6691..2285b9d 100644 --- a/report.c +++ b/report.c @@ -164,10 +164,9 @@ static int collapse_ranges(struct match_t *reduced, int nonuniques) struct match_t *reduce_matches(struct sorthash_t *obarray, int *hashcountp) /* assemble list of duplicated hashes */ { - static struct match_t dummy; - struct match_t *reduced, *sp, *tp; unsigned int nonuniques, nreduced, progress, hashcount = *hashcountp; struct sorthash_t *mp, *np; + struct match_t *reduced; if (debug) dump_array("Chunk list before reduction.\n",obarray, hashcount); @@ -217,7 +216,6 @@ struct match_t *reduce_matches(struct sorthash_t *obarray, int *hashcountp) reduced = (struct match_t *)malloc(sizeof(struct match_t) * nreduced); for (np = obarray; np < obarray + hashcount; np = mp) { - struct match_t *new; int i, heterogenous, nmatches; if (!debug && progress++ % 10000 == 0) @@ -244,7 +242,7 @@ struct match_t *reduce_matches(struct sorthash_t *obarray, int *hashcountp) printf("*** %d has %d in its clique\n", np-obarray, nmatches); for (i = 0; i < nmatches; i++) printf("%d: %s:%d:%d\n", - np-obarray+i, np[i].file, np[i].hash.start, np[i].hash.end); + np-obarray+i, np[i].file->name, np[i].hash.start, np[i].hash.end); } /* passed all tests, keep this set of ranges */ diff --git a/shred.h b/shred.h index c04cf8c..4da22a4 100644 --- a/shred.h +++ b/shred.h @@ -1,6 +1,7 @@ /* shred.h -- types for shred similarity tools */ #include +#include /* * 65,536 lines should be enough, but maybe someday this will be 32 bits. diff --git a/shredtree.c b/shredtree.c index f5c46a5..9c81542 100644 --- a/shredtree.c +++ b/shredtree.c @@ -7,7 +7,6 @@ #include #include #include -#include #include "md5.h" #include "shred.h" @@ -71,6 +70,7 @@ static int normalize(char *buf) /* normalize a buffer in place, return 0 if it should be skipped */ { if (remove_comments) + { if (remove_braces) /* remove C comments */ { char *ss = strstr(buf, "//"); @@ -96,6 +96,7 @@ static int normalize(char *buf) if (ss) *ss = '\0'; } + } if (remove_whitespace) /* strip whitespace, ignore blank lines */ { @@ -168,7 +169,7 @@ int shredfile(struct filehdr_t *file, if ((fp = fopen(file->name, "r")) == NULL) { fprintf(stderr, "shredtree: couldn't open %s, error %d\n", - file, errno); + file->name, errno); exit(1); } -- 2.43.0