Browse Source

Prototype some functions and use more compiler warnings.

Peter Pentchev 13 years ago
parent
commit
345655a30c
2 changed files with 16 additions and 2 deletions
  1. 5
    1
      Makefile
  2. 11
    1
      filejoinfs.c

+ 5
- 1
Makefile View File

@@ -1,6 +1,10 @@
1 1
 CFLAGS_DBG?=	-ggdb
2 2
 CFLAGS_OPT?=	-O2
3
-CFLAGS_WARN?=	-Wall -Wextra -Wshadow -Wformat-security
3
+CFLAGS_WARN?=	-Wall -W -Wextra -Wshadow -Wformat-security \
4
+		-std=c99 -pedantic -Wbad-function-cast \
5
+		-Wcast-align -Wcast-qual -Wchar-subscripts -Winline \
6
+		-Wmissing-prototypes -Wnested-externs -Wpointer-arith \
7
+		-Wredundant-decls -Wstrict-prototypes
4 8
 
5 9
 CFLAGS?=	${CFLAGS_DBG} ${CFLAGS_OPT}
6 10
 CFLAGS+=	${CFLAGS_WARN}

+ 11
- 1
filejoinfs.c View File

@@ -79,7 +79,15 @@ struct files {
79 79
 
80 80
 struct files *filelist;
81 81
 
82
-struct files *files_alloc() {
82
+static struct files *files_alloc(void);
83
+static void files_free(struct files **pfiles);
84
+#ifdef DO_DUMP
85
+static void files_dump(struct files *files);
86
+#endif
87
+static int files_add_file(struct files *files, char *filename);
88
+static int files_load_filelist(struct files *files, char *filename);
89
+
90
+struct files *files_alloc(void) {
83 91
 	struct files *f = calloc(1, sizeof(struct files));
84 92
 	f->alloc_files = 64;
85 93
 	f->data = calloc(f->alloc_files, sizeof(struct fileinfo *));
@@ -103,6 +111,7 @@ void files_free(struct files **pfiles) {
103 111
 	}
104 112
 }
105 113
 
114
+#ifdef DO_DUMP
106 115
 void files_dump(struct files *files) {
107 116
 	int i;
108 117
 	fprintf(stdout,"num_files:%d\n", files->num_files);
@@ -115,6 +124,7 @@ void files_dump(struct files *files) {
115 124
 		fprintf(stdout,"file[%d]->size=%llu\n", i, f->size);
116 125
 	}
117 126
 }
127
+#endif
118 128
 
119 129
 int files_add_file(struct files *files, char *filename) {
120 130
 	int ret = 0;

Loading…
Cancel
Save