forked from mirrors/kore
Build option changes.
- Build with -O2 unless NOOPT is set to 1. - Hide -g behind DEBUG instead of always building with it. - Explicitely set the standard used to c99, use pedantic.
This commit is contained in:
parent
f2f5a3742f
commit
1f5e482b8a
12
Makefile
12
Makefile
@ -11,14 +11,20 @@ S_SRC= src/kore.c src/buf.c src/cli.c src/config.c src/connection.c \
|
||||
src/pool.c src/timer.c src/utils.c src/worker.c
|
||||
S_OBJS= $(S_SRC:.c=.o)
|
||||
|
||||
CFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes
|
||||
CFLAGS+=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
|
||||
CFLAGS+=-Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual
|
||||
CFLAGS+=-Wsign-compare -Iincludes -g
|
||||
CFLAGS+=-Wsign-compare -Iincludes -std=c99 -pedantic
|
||||
CFLAGS+=-DPREFIX='"$(PREFIX)"'
|
||||
LDFLAGS=-rdynamic -lssl -lcrypto
|
||||
|
||||
ifneq ("$(DEBUG)", "")
|
||||
CFLAGS+=-DKORE_DEBUG
|
||||
CFLAGS+=-DKORE_DEBUG -g
|
||||
endif
|
||||
|
||||
ifneq ("$(NOOPT)", "")
|
||||
CFLAGS+=-O0
|
||||
else
|
||||
CFLAGS+=-O2
|
||||
endif
|
||||
|
||||
ifneq ("$(NOHTTP)", "")
|
||||
|
@ -45,7 +45,7 @@
|
||||
#define PRI_TIME_T "d"
|
||||
#endif
|
||||
|
||||
#if defined(linux)
|
||||
#if defined(__linux__)
|
||||
#if defined(__x86_64__)
|
||||
#define PRI_TIME_T PRIu64
|
||||
#else
|
||||
|
@ -297,7 +297,7 @@ http_process_request(struct http_request *req)
|
||||
|
||||
switch (r) {
|
||||
case KORE_RESULT_OK:
|
||||
cb = req->hdlr->addr;
|
||||
*(void **)&(cb) = req->hdlr->addr;
|
||||
worker->active_hdlr = req->hdlr;
|
||||
r = cb(req);
|
||||
worker->active_hdlr = NULL;
|
||||
|
@ -313,7 +313,7 @@ kore_server_bind(const char *ip, const char *port, const char *ccb)
|
||||
}
|
||||
|
||||
if (ccb != NULL) {
|
||||
l->connect = kore_module_getsym(ccb);
|
||||
*(void **)&(l->connect) = kore_module_getsym(ccb);
|
||||
if (l->connect == NULL) {
|
||||
printf("no such callback: '%s'\n", ccb);
|
||||
close(l->fd);
|
||||
|
@ -51,7 +51,7 @@ kore_module_load(const char *path, const char *onload)
|
||||
|
||||
if (onload != NULL) {
|
||||
module->onload = kore_strdup(onload);
|
||||
module->ocb = dlsym(module->handle, onload);
|
||||
*(void **)&(module->ocb) = dlsym(module->handle, onload);
|
||||
if (module->ocb == NULL)
|
||||
fatal("%s: onload '%s' not present", path, onload);
|
||||
}
|
||||
@ -107,7 +107,8 @@ kore_module_reload(int cbs)
|
||||
fatal("kore_module_reload(): %s", dlerror());
|
||||
|
||||
if (module->onload != NULL) {
|
||||
module->ocb = dlsym(module->handle, module->onload);
|
||||
*(void **)&(module->ocb) =
|
||||
dlsym(module->handle, module->onload);
|
||||
if (module->ocb == NULL) {
|
||||
fatal("%s: onload '%s' not present",
|
||||
module->path, module->onload);
|
||||
|
@ -42,7 +42,8 @@ kore_validator_add(const char *name, u_int8_t type, const char *arg)
|
||||
}
|
||||
break;
|
||||
case KORE_VALIDATOR_TYPE_FUNCTION:
|
||||
if ((val->func = kore_module_getsym(arg)) == NULL) {
|
||||
*(void **)(&val->func) = kore_module_getsym(arg);
|
||||
if (val->func == NULL) {
|
||||
kore_mem_free(val);
|
||||
kore_log(LOG_NOTICE,
|
||||
"validator %s has undefined callback %s",
|
||||
@ -112,7 +113,8 @@ kore_validator_reload(void)
|
||||
if (val->type != KORE_VALIDATOR_TYPE_FUNCTION)
|
||||
continue;
|
||||
|
||||
if ((val->func = kore_module_getsym(val->arg)) == NULL)
|
||||
*(void **)&(val->func) = kore_module_getsym(val->arg);
|
||||
if (val->func == NULL)
|
||||
fatal("no function for validator %s found", val->name);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user