Browse Source

Compile with -Wstrict-prototypes and -std=c99

Georgi Chorbadzhiyski 12 years ago
parent
commit
d542e546af
9 changed files with 12 additions and 12 deletions
  1. 5
    2
      Makefile
  2. 1
    1
      cbuf.c
  3. 0
    3
      io.c
  4. 1
    1
      list.c
  5. 1
    1
      list.h
  6. 1
    1
      log.c
  7. 1
    1
      log.h
  8. 1
    1
      queue.c
  9. 1
    1
      queue.h

+ 5
- 2
Makefile View File

1
 CC = $(CROSS)$(TARGET)gcc
1
 CC = $(CROSS)$(TARGET)gcc
2
 LINK = $(CROSS)$(TARGET)ld -o
2
 LINK = $(CROSS)$(TARGET)ld -o
3
 LIBRARY_LINK_OPTS =  -L. -r
3
 LIBRARY_LINK_OPTS =  -L. -r
4
-CFLAGS = -ggdb -Wall -Wextra -Wshadow -Wformat-security -O2
4
+CFLAGS = -O2 -ggdb -std=c99 -D_GNU_SOURCE
5
+CFLAGS += -Wall -Wextra -Wshadow -Wformat-security -Wstrict-prototypes
5
 RM = /bin/rm -f
6
 RM = /bin/rm -f
6
 Q=@
7
 Q=@
7
 
8
 
8
-OBJS = queue.o list.o cbuf.o io.o log.o http_response.o asyncdns.o server.o misc.o
9
+OBJS = queue.o list.o cbuf.o io.o log.o http_response.o asyncdns.o \
10
+       server.o misc.o
11
+
9
 PROG = libfuncs.a
12
 PROG = libfuncs.a
10
 
13
 
11
 all: $(PROG)
14
 all: $(PROG)

+ 1
- 1
cbuf.c View File

237
 	}
237
 	}
238
 }
238
 }
239
 
239
 
240
-void cbuf_test() {
240
+void cbuf_test(void) {
241
 	CBUF *in;
241
 	CBUF *in;
242
 
242
 
243
 	CBUF *out;
243
 	CBUF *out;

+ 0
- 3
io.c View File

6
  * See LICENSE-MIT.txt for license terms.
6
  * See LICENSE-MIT.txt for license terms.
7
  */
7
  */
8
 
8
 
9
-/* Needed for POLLRDHUP */
10
-#define _GNU_SOURCE 1;
11
-
12
 #include <stdio.h>
9
 #include <stdio.h>
13
 #include <stdlib.h>
10
 #include <stdlib.h>
14
 #include <stdarg.h>
11
 #include <stdarg.h>

+ 1
- 1
list.c View File

48
 	return list;
48
 	return list;
49
 }
49
 }
50
 
50
 
51
-void list_free(LIST **plist, void (*free_func)(), void (*freep_func)()) {
51
+void list_free(LIST **plist, void (*free_func)(void *), void (*freep_func)(void **)) {
52
 	LIST *list = *plist;
52
 	LIST *list = *plist;
53
 	if (!list)
53
 	if (!list)
54
 		return;
54
 		return;

+ 1
- 1
list.h View File

43
 	for (elem = (list)->head->prev; elem != (list)->head && elem->data; elem = elem->prev)
43
 	for (elem = (list)->head->prev; elem != (list)->head && elem->data; elem = elem->prev)
44
 
44
 
45
 LIST *list_new			(char *listname);
45
 LIST *list_new			(char *listname);
46
-void list_free			(LIST **l, void (*l_free)(), void (*l_freep)());
46
+void list_free			(LIST **l, void (*l_free)(void *), void (*l_freep)(void **));
47
 
47
 
48
 void list_lock			(LIST *l);
48
 void list_lock			(LIST *l);
49
 void list_unlock		(LIST *l);
49
 void list_unlock		(LIST *l);

+ 1
- 1
log.c View File

167
 	OUT_FD = new_out_fd;
167
 	OUT_FD = new_out_fd;
168
 }
168
 }
169
 
169
 
170
-void log_close() {
170
+void log_close(void) {
171
 	logger->dying = 1;
171
 	logger->dying = 1;
172
 	int count = 0;
172
 	int count = 0;
173
 	while (logger->queue->items && count++ < 250)
173
 	while (logger->queue->items && count++ < 250)

+ 1
- 1
log.h View File

15
 #include <stdio.h>
15
 #include <stdio.h>
16
 
16
 
17
 void log_init  (char *host_ident, int use_syslog, int use_stderr, char *log_host, int log_port);
17
 void log_init  (char *host_ident, int use_syslog, int use_stderr, char *log_host, int log_port);
18
-void log_close ();
18
+void log_close (void);
19
 
19
 
20
 void LOG (const char *msg);
20
 void LOG (const char *msg);
21
 
21
 

+ 1
- 1
queue.c View File

15
 #include "libfuncs.h"
15
 #include "libfuncs.h"
16
 #include "queue.h"
16
 #include "queue.h"
17
 
17
 
18
-QUEUE *queue_new() {
18
+QUEUE *queue_new(void) {
19
 	pthread_mutex_t *mutex = malloc(sizeof(pthread_mutex_t));
19
 	pthread_mutex_t *mutex = malloc(sizeof(pthread_mutex_t));
20
 	if (pthread_mutex_init(mutex,NULL) != 0) {
20
 	if (pthread_mutex_init(mutex,NULL) != 0) {
21
 		perror("queue_new: mutex_init");
21
 		perror("queue_new: mutex_init");

+ 1
- 1
queue.h View File

27
 	int items;				// number of messages in queue
27
 	int items;				// number of messages in queue
28
 } QUEUE;
28
 } QUEUE;
29
 
29
 
30
-QUEUE *queue_new		();
30
+QUEUE *queue_new		(void);
31
 void queue_free			(QUEUE **q);
31
 void queue_free			(QUEUE **q);
32
 
32
 
33
 void queue_add			(QUEUE *q, void *data);
33
 void queue_add			(QUEUE *q, void *data);

Loading…
Cancel
Save