mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-11 05:14:46 -04:00
r16733@catbus: nickm | 2007-11-26 14:18:25 -0500
Add an --enable-gcc-warnings option (lifted from Tor) to the configure script. When provided, and when we are using GCC, we enable a bunch of extra GCC warnings in the compiler. Also, make the code all build happily with these warnings. svn:r553
This commit is contained in:
parent
1120f04f3e
commit
ce4ee418d2
@ -12,8 +12,8 @@ Changes in current version:
|
||||
o The kqueue implementation now restores original signal handlers correctly when its signal events are removed.
|
||||
o Check return value of event_add in signal.c
|
||||
o Add a more powerful evbuffer_readln as a replacement for evbuffer_readline. The new function handles more newline styles, and is more useful with buffers that may contain a nul characters.
|
||||
o Do not mangle socket handles on 64-bit windows.
|
||||
|
||||
o Do not mangle socket handles on 64-bit windows.
|
||||
o The configure script now takes an --enable-gcc-warnigns option that turns on many optional gcc warnings. (Nick has been building with these for a while, but they might be useful to other developers.)
|
||||
|
||||
|
||||
Changes in 1.4.0:
|
||||
|
36
configure.in
36
configure.in
@ -21,6 +21,9 @@ if test "$GCC" = yes ; then
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(gcc-warnings,
|
||||
AS_HELP_STRING(--enable-gcc-warnings, enable verbose warnings with GCC))
|
||||
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
dnl Uncomment "AC_DISABLE_SHARED" to make shared librraries not get
|
||||
@ -335,4 +338,37 @@ AC_TRY_COMPILE([],
|
||||
[Define to appropriate substitue if compiler doesnt have __func__])))
|
||||
|
||||
|
||||
# Add some more warnings which we use in development but not in the
|
||||
# released versions. (Some relevant gcc versions can't handle these.)
|
||||
if test x$enable_gcc_warnings = xyes; then
|
||||
|
||||
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], [
|
||||
#if !defined(__GNUC__) || (__GNUC__ < 4)
|
||||
#error
|
||||
#endif]), have_gcc4=yes, have_gcc4=no)
|
||||
|
||||
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], [
|
||||
#if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)
|
||||
#error
|
||||
#endif]), have_gcc42=yes, have_gcc42=no)
|
||||
|
||||
CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat=2 -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wbad-function-cast -Wswitch-enum -Werror"
|
||||
CFLAGS="$CFLAGS -Wno-unused-parameter -Wno-sign-compare"
|
||||
|
||||
if test x$have_gcc4 = xyes ; then
|
||||
# These warnings break gcc 3.3.5 and work on gcc 4.0.2
|
||||
CFLAGS="$CFLAGS -Winit-self -Wmissing-field-initializers -Wdeclaration-after-statement"
|
||||
#CFLAGS="$CFLAGS -Wold-style-definition"
|
||||
fi
|
||||
|
||||
if test x$have_gcc42 = xyes ; then
|
||||
# These warnings break gcc 4.0.2 and work on gcc 4.2
|
||||
CFLAGS="$CFLAGS -Waddress -Wnormalized=id -Woverride-init"
|
||||
fi
|
||||
|
||||
##This will break the world on some 64-bit architectures
|
||||
# CFLAGS="$CFLAGS -Winline"
|
||||
|
||||
fi
|
||||
|
||||
AC_OUTPUT(Makefile test/Makefile sample/Makefile)
|
||||
|
2
http.c
2
http.c
@ -443,7 +443,7 @@ evhttp_make_header(struct evhttp_connection *evcon, struct evhttp_request *req)
|
||||
|
||||
/* XXX EVBUFFER_LENGTH returns an unsigned value, so this test
|
||||
* is always true. What is the intent of this test? -NM */
|
||||
if (EVBUFFER_LENGTH(req->output_buffer) >= 0) {
|
||||
if (1) { // || EVBUFFER_LENGTH(req->output_buffer) >= 0) {
|
||||
/*
|
||||
* For a request, we add the POST data, for a reply, this
|
||||
* is the regular data.
|
||||
|
3
poll.c
3
poll.c
@ -79,7 +79,8 @@ const struct eventop pollops = {
|
||||
poll_del,
|
||||
poll_recalc,
|
||||
poll_dispatch,
|
||||
poll_dealloc
|
||||
poll_dealloc,
|
||||
0
|
||||
};
|
||||
|
||||
void *
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include <event.h>
|
||||
|
||||
void
|
||||
static void
|
||||
fifo_read(int fd, short event, void *arg)
|
||||
{
|
||||
char buf[255];
|
||||
@ -86,7 +86,7 @@ main (int argc, char **argv)
|
||||
|
||||
#else
|
||||
struct stat st;
|
||||
char *fifo = "event.fifo";
|
||||
const char *fifo = "event.fifo";
|
||||
int socket;
|
||||
|
||||
if (lstat (fifo, &st) == 0) {
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
int called = 0;
|
||||
|
||||
void
|
||||
static void
|
||||
signal_cb(int fd, short event, void *arg)
|
||||
{
|
||||
struct event *signal = arg;
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
int lasttime;
|
||||
|
||||
void
|
||||
static void
|
||||
timeout_cb(int fd, short event, void *arg)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
3
select.c
3
select.c
@ -84,7 +84,8 @@ const struct eventop selectops = {
|
||||
select_del,
|
||||
select_recalc,
|
||||
select_dispatch,
|
||||
select_dealloc
|
||||
select_dealloc,
|
||||
0
|
||||
};
|
||||
|
||||
static int select_resize(struct selectop *sop, int fdsz);
|
||||
|
@ -64,7 +64,7 @@ static struct event *events;
|
||||
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
read_cb(int fd, short which, void *arg)
|
||||
{
|
||||
int idx = (int) arg, widx = idx + 1;
|
||||
@ -80,7 +80,7 @@ read_cb(int fd, short which, void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
struct timeval *
|
||||
static struct timeval *
|
||||
run_once(void)
|
||||
{
|
||||
int *cp, i, space;
|
||||
@ -127,7 +127,6 @@ main (int argc, char **argv)
|
||||
int i, c;
|
||||
struct timeval *tv;
|
||||
int *cp;
|
||||
extern char *optarg;
|
||||
|
||||
num_pipes = 100;
|
||||
num_active = 1;
|
||||
|
101
test/regress.c
101
test/regress.c
@ -86,7 +86,7 @@ static struct event_base *global_base;
|
||||
#define read(fd,buf,len) recv((fd),(buf),(len),0)
|
||||
#endif
|
||||
|
||||
void
|
||||
static void
|
||||
simple_read_cb(int fd, short event, void *arg)
|
||||
{
|
||||
char buf[256];
|
||||
@ -105,7 +105,7 @@ simple_read_cb(int fd, short event, void *arg)
|
||||
called++;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
simple_write_cb(int fd, short event, void *arg)
|
||||
{
|
||||
int len;
|
||||
@ -117,7 +117,7 @@ simple_write_cb(int fd, short event, void *arg)
|
||||
test_ok = 1;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
multiple_write_cb(int fd, short event, void *arg)
|
||||
{
|
||||
struct event *ev = arg;
|
||||
@ -150,7 +150,7 @@ multiple_write_cb(int fd, short event, void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
multiple_read_cb(int fd, short event, void *arg)
|
||||
{
|
||||
struct event *ev = arg;
|
||||
@ -172,7 +172,7 @@ multiple_read_cb(int fd, short event, void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
timeout_cb(int fd, short event, void *arg)
|
||||
{
|
||||
struct timeval tv;
|
||||
@ -192,12 +192,13 @@ timeout_cb(int fd, short event, void *arg)
|
||||
test_ok = 1;
|
||||
}
|
||||
|
||||
void signal_cb_sa(int sig)
|
||||
static void
|
||||
signal_cb_sa(int sig)
|
||||
{
|
||||
test_ok = 2;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
signal_cb(int fd, short event, void *arg)
|
||||
{
|
||||
struct event *ev = arg;
|
||||
@ -211,7 +212,7 @@ struct both {
|
||||
int nread;
|
||||
};
|
||||
|
||||
void
|
||||
static void
|
||||
combined_read_cb(int fd, short event, void *arg)
|
||||
{
|
||||
struct both *both = arg;
|
||||
@ -229,7 +230,7 @@ combined_read_cb(int fd, short event, void *arg)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
combined_write_cb(int fd, short event, void *arg)
|
||||
{
|
||||
struct both *both = arg;
|
||||
@ -255,8 +256,8 @@ combined_write_cb(int fd, short event, void *arg)
|
||||
|
||||
/* Test infrastructure */
|
||||
|
||||
int
|
||||
setup_test(char *name)
|
||||
static int
|
||||
setup_test(const char *name)
|
||||
{
|
||||
|
||||
fprintf(stdout, "%s", name);
|
||||
@ -279,7 +280,7 @@ setup_test(char *name)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
cleanup_test(void)
|
||||
{
|
||||
#ifndef WIN32
|
||||
@ -299,7 +300,7 @@ cleanup_test(void)
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_simpleread(void)
|
||||
{
|
||||
struct event ev;
|
||||
@ -318,7 +319,7 @@ test_simpleread(void)
|
||||
cleanup_test();
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_simplewrite(void)
|
||||
{
|
||||
struct event ev;
|
||||
@ -334,7 +335,7 @@ test_simplewrite(void)
|
||||
cleanup_test();
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_multiple(void)
|
||||
{
|
||||
struct event ev, ev2;
|
||||
@ -363,7 +364,7 @@ test_multiple(void)
|
||||
cleanup_test();
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_persistent(void)
|
||||
{
|
||||
struct event ev, ev2;
|
||||
@ -392,7 +393,7 @@ test_persistent(void)
|
||||
cleanup_test();
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_combined(void)
|
||||
{
|
||||
struct both r1, r2, w1, w2;
|
||||
@ -427,7 +428,7 @@ test_combined(void)
|
||||
cleanup_test();
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_simpletimeout(void)
|
||||
{
|
||||
struct timeval tv;
|
||||
@ -447,7 +448,8 @@ test_simpletimeout(void)
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
void
|
||||
extern struct event_base *current_base;
|
||||
static void
|
||||
test_fork(void)
|
||||
{
|
||||
int status;
|
||||
@ -465,7 +467,6 @@ test_fork(void)
|
||||
|
||||
if ((pid = fork()) == 0) {
|
||||
/* in the child */
|
||||
extern struct event_base *current_base;
|
||||
if (event_reinit(current_base) == -1) {
|
||||
fprintf(stderr, "FAILED (reinit)\n");
|
||||
exit(1);
|
||||
@ -488,7 +489,7 @@ test_fork(void)
|
||||
cleanup_test();
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_simplesignal(void)
|
||||
{
|
||||
struct event ev;
|
||||
@ -511,7 +512,7 @@ test_simplesignal(void)
|
||||
cleanup_test();
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_immediatesignal(void)
|
||||
{
|
||||
struct event ev;
|
||||
@ -526,7 +527,7 @@ test_immediatesignal(void)
|
||||
cleanup_test();
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_signal_dealloc(void)
|
||||
{
|
||||
/* make sure that signal_event is event_del'ed and pipe closed */
|
||||
@ -542,7 +543,7 @@ test_signal_dealloc(void)
|
||||
cleanup_test();
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_signal_pipeloss(void)
|
||||
{
|
||||
/* make sure that the base1 pipe is closed correctly. */
|
||||
@ -570,7 +571,7 @@ test_signal_pipeloss(void)
|
||||
* for event mechanisms that use our signal pipe trick. kqueue handles
|
||||
* signals internally, and all interested kqueues get all the signals.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
test_signal_switchbase(void)
|
||||
{
|
||||
struct event ev1, ev2;
|
||||
@ -620,8 +621,8 @@ test_signal_switchbase(void)
|
||||
* assert that a signal event removed from the event queue really is
|
||||
* removed - with no possibility of it's parent handler being fired.
|
||||
*/
|
||||
void
|
||||
test_signal_assert()
|
||||
static void
|
||||
test_signal_assert(void)
|
||||
{
|
||||
struct event ev;
|
||||
struct event_base *base = event_init();
|
||||
@ -651,8 +652,8 @@ test_signal_assert()
|
||||
/*
|
||||
* assert that we restore our previous signal handler properly.
|
||||
*/
|
||||
void
|
||||
test_signal_restore()
|
||||
static void
|
||||
test_signal_restore(void)
|
||||
{
|
||||
struct event ev;
|
||||
struct event_base *base = event_init();
|
||||
@ -687,7 +688,7 @@ out:
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
static void
|
||||
test_free_active_base(void)
|
||||
{
|
||||
struct event_base *base1;
|
||||
@ -703,7 +704,7 @@ test_free_active_base(void)
|
||||
cleanup_test();
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_event_base_new(void)
|
||||
{
|
||||
struct event_base *base;
|
||||
@ -725,7 +726,7 @@ test_event_base_new(void)
|
||||
cleanup_test();
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_loopexit(void)
|
||||
{
|
||||
struct timeval tv, tv_start, tv_end;
|
||||
@ -768,7 +769,7 @@ fail_cb(int fd, short events, void *arg)
|
||||
test_ok = 0;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_loopbreak(void)
|
||||
{
|
||||
struct event ev1, ev2;
|
||||
@ -791,7 +792,7 @@ test_loopbreak(void)
|
||||
cleanup_test();
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_evbuffer(void) {
|
||||
|
||||
struct evbuffer *evb = evbuffer_new();
|
||||
@ -808,7 +809,7 @@ test_evbuffer(void) {
|
||||
cleanup_test();
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_evbuffer_readln(void)
|
||||
{
|
||||
struct evbuffer *evb = evbuffer_new();
|
||||
@ -917,12 +918,12 @@ test_evbuffer_readln(void)
|
||||
cleanup_test();
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_evbuffer_find(void)
|
||||
{
|
||||
u_char* p;
|
||||
char* test1 = "1234567890\r\n";
|
||||
char* test2 = "1234567890\r";
|
||||
const char* test1 = "1234567890\r\n";
|
||||
const char* test2 = "1234567890\r";
|
||||
#define EVBUFFER_INITIAL_LENGTH 256
|
||||
char test3[EVBUFFER_INITIAL_LENGTH];
|
||||
unsigned int i;
|
||||
@ -972,7 +973,7 @@ test_evbuffer_find(void)
|
||||
evbuffer_free(buf);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
readcb(struct bufferevent *bev, void *arg)
|
||||
{
|
||||
if (EVBUFFER_LENGTH(bev->input) == 8333) {
|
||||
@ -981,20 +982,20 @@ readcb(struct bufferevent *bev, void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
writecb(struct bufferevent *bev, void *arg)
|
||||
{
|
||||
if (EVBUFFER_LENGTH(bev->output) == 0)
|
||||
test_ok++;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
errorcb(struct bufferevent *bev, short what, void *arg)
|
||||
{
|
||||
test_ok = -2;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_bufferevent(void)
|
||||
{
|
||||
struct bufferevent *bev1, *bev2;
|
||||
@ -1030,7 +1031,7 @@ struct test_pri_event {
|
||||
int count;
|
||||
};
|
||||
|
||||
void
|
||||
static void
|
||||
test_priorities_cb(int fd, short what, void *arg)
|
||||
{
|
||||
struct test_pri_event *pri = arg;
|
||||
@ -1047,7 +1048,7 @@ test_priorities_cb(int fd, short what, void *arg)
|
||||
event_add(&pri->ev, &tv);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_priorities(int npriorities)
|
||||
{
|
||||
char buf[32];
|
||||
@ -1110,7 +1111,7 @@ test_multiple_cb(int fd, short event, void *arg)
|
||||
test_ok |= 2;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_multiple_events_for_same_fd(void)
|
||||
{
|
||||
struct event e1, e2;
|
||||
@ -1135,7 +1136,7 @@ test_multiple_events_for_same_fd(void)
|
||||
|
||||
int decode_int(uint32_t *pnumber, struct evbuffer *evbuf);
|
||||
|
||||
void
|
||||
static void
|
||||
read_once_cb(int fd, short event, void *arg)
|
||||
{
|
||||
char buf[256];
|
||||
@ -1154,7 +1155,7 @@ read_once_cb(int fd, short event, void *arg)
|
||||
called++;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
test_want_only_once(void)
|
||||
{
|
||||
struct event ev;
|
||||
@ -1180,7 +1181,7 @@ test_want_only_once(void)
|
||||
|
||||
#define TEST_MAX_INT 6
|
||||
|
||||
void
|
||||
static void
|
||||
evtag_int_test(void)
|
||||
{
|
||||
struct evbuffer *tmp = evbuffer_new();
|
||||
@ -1220,7 +1221,7 @@ evtag_int_test(void)
|
||||
fprintf(stdout, "\t%s: OK\n", __func__);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
evtag_fuzz(void)
|
||||
{
|
||||
u_char buffer[4096];
|
||||
@ -1275,7 +1276,7 @@ evtag_test(void)
|
||||
fprintf(stdout, "OK\n");
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
rpc_test(void)
|
||||
{
|
||||
struct msg *msg, *msg2;
|
||||
|
@ -66,7 +66,9 @@
|
||||
static int dns_ok = 0;
|
||||
static int dns_err = 0;
|
||||
|
||||
void
|
||||
void dns_suite(void);
|
||||
|
||||
static void
|
||||
dns_gethostbyname_cb(int result, char type, int count, int ttl,
|
||||
void *addresses, void *arg)
|
||||
{
|
||||
@ -131,7 +133,7 @@ out:
|
||||
event_loopexit(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dns_gethostbyname(void)
|
||||
{
|
||||
fprintf(stdout, "Simple DNS resolve: ");
|
||||
@ -147,7 +149,7 @@ dns_gethostbyname(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dns_gethostbyname6(void)
|
||||
{
|
||||
fprintf(stdout, "IPv6 DNS resolve: ");
|
||||
@ -165,7 +167,7 @@ dns_gethostbyname6(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dns_gethostbyaddr(void)
|
||||
{
|
||||
struct in_addr in;
|
||||
@ -230,7 +232,7 @@ dns_server_request_cb(struct evdns_server_request *req, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dns_server_gethostbyname_cb(int result, char type, int count, int ttl,
|
||||
void *addresses, void *arg)
|
||||
{
|
||||
@ -290,7 +292,7 @@ dns_server_gethostbyname_cb(int result, char type, int count, int ttl,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dns_server(void)
|
||||
{
|
||||
int sock;
|
||||
|
@ -64,6 +64,8 @@ static struct evhttp *http;
|
||||
/* set if a test needs to call loopexit on a base */
|
||||
static struct event_base *base;
|
||||
|
||||
void http_suite(void);
|
||||
|
||||
void http_basic_cb(struct evhttp_request *req, void *arg);
|
||||
void http_post_cb(struct evhttp_request *req, void *arg);
|
||||
void http_dispatcher_cb(struct evhttp_request *req, void *arg);
|
||||
@ -100,7 +102,7 @@ http_setup(short *pport, struct event_base *base)
|
||||
#define NI_MAXSERV 1024
|
||||
#endif
|
||||
|
||||
int
|
||||
static int
|
||||
http_connect(const char *address, u_short port)
|
||||
{
|
||||
/* Stupid code for connecting */
|
||||
@ -150,7 +152,7 @@ http_connect(const char *address, u_short port)
|
||||
return (fd);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
http_readcb(struct bufferevent *bev, void *arg)
|
||||
{
|
||||
const char *what = "This is funny";
|
||||
@ -178,7 +180,7 @@ http_readcb(struct bufferevent *bev, void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
http_writecb(struct bufferevent *bev, void *arg)
|
||||
{
|
||||
if (EVBUFFER_LENGTH(bev->output) == 0) {
|
||||
@ -188,7 +190,7 @@ http_writecb(struct bufferevent *bev, void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
http_errorcb(struct bufferevent *bev, short what, void *arg)
|
||||
{
|
||||
test_ok = -2;
|
||||
@ -208,12 +210,12 @@ http_basic_cb(struct evhttp_request *req, void *arg)
|
||||
evbuffer_free(evb);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
http_basic_test(void)
|
||||
{
|
||||
struct bufferevent *bev;
|
||||
int fd;
|
||||
char *http_request;
|
||||
const char *http_request;
|
||||
short port = -1;
|
||||
|
||||
test_ok = 0;
|
||||
@ -252,7 +254,7 @@ http_basic_test(void)
|
||||
|
||||
void http_request_done(struct evhttp_request *, void *);
|
||||
|
||||
void
|
||||
static void
|
||||
http_connection_test(int persistent)
|
||||
{
|
||||
short port = -1;
|
||||
@ -370,7 +372,7 @@ http_dispatcher_cb(struct evhttp_request *req, void *arg)
|
||||
evbuffer_free(evb);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
http_dispatcher_test_done(struct evhttp_request *req, void *arg)
|
||||
{
|
||||
const char *what = "DISPATCHER_TEST";
|
||||
@ -400,7 +402,7 @@ http_dispatcher_test_done(struct evhttp_request *req, void *arg)
|
||||
event_loopexit(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
http_dispatcher_test(void)
|
||||
{
|
||||
short port = -1;
|
||||
@ -461,7 +463,7 @@ void http_postrequest_done(struct evhttp_request *, void *);
|
||||
|
||||
#define POST_DATA "Okay. Not really printf"
|
||||
|
||||
void
|
||||
static void
|
||||
http_post_test(void)
|
||||
{
|
||||
short port = -1;
|
||||
@ -582,7 +584,7 @@ http_postrequest_done(struct evhttp_request *req, void *arg)
|
||||
event_loopexit(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
http_failure_readcb(struct bufferevent *bev, void *arg)
|
||||
{
|
||||
const char *what = "400 Bad Request";
|
||||
@ -596,12 +598,12 @@ http_failure_readcb(struct bufferevent *bev, void *arg)
|
||||
/*
|
||||
* Testing that the HTTP server can deal with a malformed request.
|
||||
*/
|
||||
void
|
||||
static void
|
||||
http_failure_test(void)
|
||||
{
|
||||
struct bufferevent *bev;
|
||||
int fd;
|
||||
char *http_request;
|
||||
const char *http_request;
|
||||
short port = -1;
|
||||
|
||||
test_ok = 0;
|
||||
@ -685,7 +687,7 @@ close_detect_cb(struct evhttp_request *req, void *arg)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
http_close_detection(void)
|
||||
{
|
||||
short port = -1;
|
||||
@ -735,7 +737,7 @@ http_close_detection(void)
|
||||
fprintf(stdout, "OK\n");
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
http_highport_test(void)
|
||||
{
|
||||
int i = -1;
|
||||
@ -757,7 +759,7 @@ http_highport_test(void)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
http_bad_header_test(void)
|
||||
{
|
||||
struct evkeyvalq headers;
|
||||
@ -790,12 +792,12 @@ fail:
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
http_base_test(void)
|
||||
{
|
||||
struct bufferevent *bev;
|
||||
int fd;
|
||||
char *http_request;
|
||||
const char *http_request;
|
||||
short port = -1;
|
||||
|
||||
test_ok = 0;
|
||||
|
@ -60,6 +60,8 @@
|
||||
|
||||
#include "regress.gen.h"
|
||||
|
||||
void rpc_suite(void);
|
||||
|
||||
extern int test_ok;
|
||||
|
||||
static struct evhttp *
|
||||
@ -94,7 +96,7 @@ EVRPC_GENERATE(NeverReply, msg, kill);
|
||||
static int need_input_hook = 0;
|
||||
static int need_output_hook = 0;
|
||||
|
||||
void
|
||||
static void
|
||||
MessageCb(EVRPC_STRUCT(Message)* rpc, void *arg)
|
||||
{
|
||||
struct kill* kill_reply = rpc->reply;
|
||||
@ -116,7 +118,7 @@ MessageCb(EVRPC_STRUCT(Message)* rpc, void *arg)
|
||||
|
||||
static EVRPC_STRUCT(NeverReply) *saved_rpc;
|
||||
|
||||
void
|
||||
static void
|
||||
NeverReplyCb(EVRPC_STRUCT(NeverReply)* rpc, void *arg)
|
||||
{
|
||||
test_ok += 1;
|
||||
@ -448,14 +450,14 @@ rpc_basic_client(void)
|
||||
need_input_hook = 1;
|
||||
need_output_hook = 1;
|
||||
|
||||
assert(evrpc_add_hook(base, INPUT, rpc_hook_add_header, "input")
|
||||
assert(evrpc_add_hook(base, INPUT, rpc_hook_add_header, (void*)"input")
|
||||
!= NULL);
|
||||
assert(evrpc_add_hook(base, OUTPUT, rpc_hook_add_header, "output")
|
||||
assert(evrpc_add_hook(base, OUTPUT, rpc_hook_add_header, (void*)"output")
|
||||
!= NULL);
|
||||
|
||||
pool = rpc_pool_with_connection(port);
|
||||
|
||||
assert(evrpc_add_hook(pool, INPUT, rpc_hook_remove_header, "output"));
|
||||
assert(evrpc_add_hook(pool, INPUT, rpc_hook_remove_header, (void*)"output"));
|
||||
|
||||
/* set up the basic message */
|
||||
msg = msg_new();
|
||||
|
@ -29,7 +29,7 @@
|
||||
int test_okay = 1;
|
||||
int called = 0;
|
||||
|
||||
void
|
||||
static void
|
||||
read_cb(int fd, short event, void *arg)
|
||||
{
|
||||
char buf[256];
|
||||
@ -57,7 +57,7 @@ int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
struct event ev;
|
||||
char *test = "test string";
|
||||
const char *test = "test string";
|
||||
int pair[2];
|
||||
|
||||
if (evutil_socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == -1)
|
||||
|
@ -25,7 +25,7 @@ int called = 0;
|
||||
|
||||
struct event *ev[NEVENT];
|
||||
|
||||
int
|
||||
static int
|
||||
rand_int(int n)
|
||||
{
|
||||
#ifdef WIN32
|
||||
@ -35,7 +35,7 @@ rand_int(int n)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
time_cb(int fd, short event, void *arg)
|
||||
{
|
||||
struct timeval tv;
|
||||
|
@ -31,10 +31,10 @@ int pair[2];
|
||||
int test_okay = 1;
|
||||
int called = 0;
|
||||
|
||||
void
|
||||
static void
|
||||
write_cb(int fd, short event, void *arg)
|
||||
{
|
||||
char *test = "test string";
|
||||
const char *test = "test string";
|
||||
int len;
|
||||
|
||||
len = write(fd, test, strlen(test) + 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user