diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/globals.h | 2 | ||||
-rw-r--r-- | src/os_unix.c | 18 | ||||
-rw-r--r-- | src/os_unix_defs.h | 20 |
3 files changed, 15 insertions, 25 deletions
diff --git a/src/globals.h b/src/globals.h index eb87aa90b1..e4b2ba562b 100644 --- a/src/globals.h +++ b/src/globals.h @@ -592,7 +592,6 @@ EXTERN int orig_line_count INIT(= 0); /* Line count when "gR" started */ EXTERN int vr_lines_changed INIT(= 0); /* #Lines changed by "gR" so far */ -#if defined(HAVE_SETJMP_H) /* * Stuff for setjmp() and longjmp(). * Used to protect areas where we could crash. @@ -605,7 +604,6 @@ EXTERN volatile int lc_signal; /* caught signal number, 0 when no was signal # endif /* volatile because it is used in signal handler deathtrap(). */ EXTERN volatile int lc_active INIT(= FALSE); /* TRUE when lc_jump_env is valid. */ -#endif /* * These flags are set based upon 'fileencoding'. diff --git a/src/os_unix.c b/src/os_unix.c index 9da5566ad2..8d42f54677 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -340,7 +340,7 @@ catch_sigpwr SIGDEFARG(sigarg) { #endif -#if (defined(HAVE_SETJMP_H) && defined(FEAT_LIBCALL)) || defined(PROTO) +#if defined(FEAT_LIBCALL) || defined(PROTO) /* * A simplistic version of setjmp() that only allows one level of using. * Don't call twice before calling mch_endjmp()!. @@ -401,21 +401,19 @@ deathtrap SIGDEFARG(sigarg) { int i; #endif -#if defined(HAVE_SETJMP_H) /* * Catch a crash in protected code. * Restores the environment saved in lc_jump_env, which looks like * SETJMP() returns 1. */ if (lc_active) { -# if defined(SIGHASARG) +#if defined(SIGHASARG) lc_signal = sigarg; -# endif +#endif lc_active = FALSE; /* don't jump again */ LONGJMP(lc_jump_env, 1); /* NOTREACHED */ } -#endif #ifdef SIGHASARG # ifdef SIGQUIT @@ -3043,7 +3041,6 @@ int *number_result; /* If the handle is valid, try to get the function address. */ if (hinstLib != NULL) { -# ifdef HAVE_SETJMP_H /* * Catch a crash when calling the library function. For example when * using a number where a string pointer is expected. @@ -3051,12 +3048,11 @@ int *number_result; mch_startjmp(); if (SETJMP(lc_jump_env) != 0) { success = FALSE; -# if defined(USE_DLOPEN) +# if defined(USE_DLOPEN) dlerr = NULL; -# endif +# endif mch_didjmp(); } else -# endif { retval_str = NULL; retval_int = 0; @@ -3111,9 +3107,8 @@ int *number_result; *string_result = vim_strsave(retval_str); } -# ifdef HAVE_SETJMP_H mch_endjmp(); -# ifdef SIGHASARG +# ifdef SIGHASARG if (lc_signal != 0) { int i; @@ -3123,7 +3118,6 @@ int *number_result; break; EMSG2("E368: got SIG%s in libcall()", signal_info[i].name); } -# endif # endif # if defined(USE_DLOPEN) diff --git a/src/os_unix_defs.h b/src/os_unix_defs.h index d65e606d6e..cb7d888bb1 100644 --- a/src/os_unix_defs.h +++ b/src/os_unix_defs.h @@ -287,17 +287,15 @@ int mch_rename(const char *src, const char *dest); # include <strings.h> #endif -#if defined(HAVE_SETJMP_H) -# include <setjmp.h> -# ifdef HAVE_SIGSETJMP -# define JMP_BUF sigjmp_buf -# define SETJMP(x) sigsetjmp((x), 1) -# define LONGJMP siglongjmp -# else -# define JMP_BUF jmp_buf -# define SETJMP(x) setjmp(x) -# define LONGJMP longjmp -# endif +#include <setjmp.h> +#ifdef HAVE_SIGSETJMP +# define JMP_BUF sigjmp_buf +# define SETJMP(x) sigsetjmp((x), 1) +# define LONGJMP siglongjmp +#else +# define JMP_BUF jmp_buf +# define SETJMP(x) setjmp(x) +# define LONGJMP longjmp #endif #define HAVE_DUP /* have dup() */ |