Declare signal handler function as "__cdecl" on Windows.

I swear, they must have half a dozen different calling conventions.

(goes to check)

Holy crud.  They actually do.  There's __cdecl, __stdcall, __fastcall,
"thiscall", "naked" and the obsolete "__pascal", "__fortran", and
"__syscall".  And don't forget WINAPI and __far.

Anyways, this should fix 3044488 if I got it right.
This commit is contained in:
Nick Mathewson 2010-09-02 12:06:58 -04:00
parent acc4aca49e
commit f0056d041b

View File

@ -62,6 +62,12 @@
#include "log-internal.h" #include "log-internal.h"
#include "evmap-internal.h" #include "evmap-internal.h"
#ifndef WIN32
/* Windows wants us to call our signal handlers as __cdecl. Nobody else
* expects you to do anything crazy like this. */
#define __cdecl
#endif
static int evsig_add(struct event_base *, int, short, short, void *); static int evsig_add(struct event_base *, int, short, short, void *);
static int evsig_del(struct event_base *, int, short, short, void *); static int evsig_del(struct event_base *, int, short, short, void *);
@ -77,7 +83,7 @@ static const struct eventop evsigops = {
struct event_base *evsig_base = NULL; struct event_base *evsig_base = NULL;
static void evsig_handler(int sig); static void __cdecl evsig_handler(int sig);
/* Callback for when the signal handler write a byte to our signaling socket */ /* Callback for when the signal handler write a byte to our signaling socket */
static void static void
@ -141,7 +147,7 @@ evsig_init(struct event_base *base)
* we can restore the original handler when we clear the current one. */ * we can restore the original handler when we clear the current one. */
int int
_evsig_set_handler(struct event_base *base, _evsig_set_handler(struct event_base *base,
int evsignal, void (*handler)(int)) int evsignal, void (*__cdecl handler)(int))
{ {
#ifdef _EVENT_HAVE_SIGACTION #ifdef _EVENT_HAVE_SIGACTION
struct sigaction sa; struct sigaction sa;
@ -270,7 +276,7 @@ evsig_del(struct event_base *base, int evsignal, short old, short events, void *
return (_evsig_restore_handler(base, evsignal)); return (_evsig_restore_handler(base, evsignal));
} }
static void static void __cdecl
evsig_handler(int sig) evsig_handler(int sig)
{ {
int save_errno = errno; int save_errno = errno;