]> Savannah Git Hosting - gnulib.git/commitdiff
raise: Make it possible to namespace the defined symbol.
authorBruno Haible <bruno@clisp.org>
Fri, 5 Oct 2018 19:53:24 +0000 (21:53 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 5 Oct 2018 19:53:24 +0000 (21:53 +0200)
* lib/raise.c (raise): Undefine only after the replacement function has
been defined.
(raise): Renamed from rpl_raise.
(raise_nothrow): Move to the end of the compilation unit.

ChangeLog
lib/raise.c

index 8d2921dc8a3373f9b988f5951e792a1905fcf74b..8d4d249829da1b597e8d16882aa33c7d8966bd0d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2018-10-05  Bruno Haible  <bruno@clisp.org>
+
+       raise: Make it possible to namespace the defined symbol.
+       * lib/raise.c (raise): Undefine only after the replacement function has
+       been defined.
+       (raise): Renamed from rpl_raise.
+       (raise_nothrow): Move to the end of the compilation unit.
+
 2018-10-05  Bruno Haible  <bruno@clisp.org>
 
        memcmp: Make it possible to namespace the defined symbol.
index 3a29339a66a3df54330aa473422047759b0b4d32..8a93bea7f770c2899d72135f94c1e3c7b58c7e5a 100644 (file)
 #  include "msvc-inval.h"
 # endif
 
-# undef raise
-
 # if HAVE_MSVC_INVALID_PARAMETER_HANDLER
-static int
-raise_nothrow (int sig)
-{
-  int result;
-
-  TRY_MSVC_INVAL
-    {
-      result = raise (sig);
-    }
-  CATCH_MSVC_INVAL
-    {
-      result = -1;
-      errno = EINVAL;
-    }
-  DONE_MSVC_INVAL;
-
-  return result;
-}
+/* Forward declaration.  */
+static int raise_nothrow (int sig);
 # else
 #  define raise_nothrow raise
 # endif
@@ -61,12 +43,11 @@ raise_nothrow (int sig)
 
 # include <unistd.h>
 
-# define rpl_raise raise
-
 #endif
 
 int
-rpl_raise (int sig)
+raise (int sig)
+#undef raise
 {
 #if GNULIB_defined_signal_blocking && GNULIB_defined_SIGPIPE
   if (sig == SIGPIPE)
@@ -79,3 +60,24 @@ rpl_raise (int sig)
   return kill (getpid (), sig);
 #endif
 }
+
+#if HAVE_RAISE && HAVE_MSVC_INVALID_PARAMETER_HANDLER
+static int
+raise_nothrow (int sig)
+{
+  int result;
+
+  TRY_MSVC_INVAL
+    {
+      result = raise (sig);
+    }
+  CATCH_MSVC_INVAL
+    {
+      result = -1;
+      errno = EINVAL;
+    }
+  DONE_MSVC_INVAL;
+
+  return result;
+}
+#endif