From: Bruno Haible Date: Fri, 5 Oct 2018 19:53:24 +0000 (+0200) Subject: raise: Make it possible to namespace the defined symbol. X-Git-Tag: v1.0~5374 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=a50f188c7928e3d01d1b4c59712c50c3a571bfd0;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 8d2921dc8a..8d4d249829 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2018-10-05 Bruno Haible + + 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 memcmp: Make it possible to namespace the defined symbol. diff --git a/lib/raise.c b/lib/raise.c index 3a29339a66..8a93bea7f7 100644 --- a/lib/raise.c +++ b/lib/raise.c @@ -31,27 +31,9 @@ # 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 -# 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