]> granicus.if.org Git - libevent/commitdiff
Declare signal handler function as "__cdecl" on Windows.
authorNick Mathewson <nickm@torproject.org>
Thu, 2 Sep 2010 16:06:58 +0000 (12:06 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 2 Sep 2010 16:06:58 +0000 (12:06 -0400)
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.

signal.c

index 1954223d6638002868955c8287962d53c203d201..d39514ff1da74b9d10219076cc4d32060e397c9b 100644 (file)
--- a/signal.c
+++ b/signal.c
 #include "log-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_del(struct event_base *, int, short, short, void *);
 
@@ -77,7 +83,7 @@ static const struct eventop evsigops = {
 
 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 */
 static void
@@ -141,7 +147,7 @@ evsig_init(struct event_base *base)
  * we can restore the original handler when we clear the current one. */
 int
 _evsig_set_handler(struct event_base *base,
-                     int evsignal, void (*handler)(int))
+    int evsignal, void (*__cdecl handler)(int))
 {
 #ifdef _EVENT_HAVE_SIGACTION
        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));
 }
 
-static void
+static void __cdecl
 evsig_handler(int sig)
 {
        int save_errno = errno;