aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicolas Hillegeer <nicolas@hillegeer.com>2014-06-02 22:20:34 +0200
committerJustin M. Keyes <justinkz@gmail.com>2014-06-28 14:44:16 -0400
commitbbb649ac696e2c8f8ec3a1cd46e8b1b1803ce9d1 (patch)
treef647dd0cf269b8fbb7ca3556a859bf6686f77a89 /src
parent99163c9f13fd212afbb7a051c599914af942433a (diff)
downloadrneovim-bbb649ac696e2c8f8ec3a1cd46e8b1b1803ce9d1.tar.gz
rneovim-bbb649ac696e2c8f8ec3a1cd46e8b1b1803ce9d1.tar.bz2
rneovim-bbb649ac696e2c8f8ec3a1cd46e8b1b1803ce9d1.zip
os: remove legacy mch_libcall
Remove as much leftover cruft as possible. Tried to see which globals are now not used anymore.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/globals.h13
-rw-r--r--src/nvim/os_unix.c185
-rw-r--r--src/nvim/os_unix_defs.h11
3 files changed, 0 insertions, 209 deletions
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 903a02ca4e..73b261780c 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -600,19 +600,6 @@ EXTERN int vr_lines_changed INIT(= 0); /* #Lines changed by "gR" so far */
/*
- * Stuff for setjmp() and longjmp().
- * Used to protect areas where we could crash.
- */
-EXTERN JMP_BUF lc_jump_env; /* argument to SETJMP() */
-# ifdef SIGHASARG
-/* volatile because it is used in signal handlers. */
-EXTERN volatile int lc_signal; /* caught signal number, 0 when no was signal
- caught; used for mch_libcall() */
-# endif
-/* volatile because it is used in signal handler deathtrap(). */
-EXTERN volatile int lc_active INIT(= FALSE); /* TRUE when lc_jump_env is valid. */
-
-/*
* These flags are set based upon 'fileencoding'.
* Note that "enc_utf8" is also set for "unicode", because the characters are
* internally stored as UTF-8 (to avoid trouble with NUL bytes).
diff --git a/src/nvim/os_unix.c b/src/nvim/os_unix.c
index 6d1b06dbcf..36194d8692 100644
--- a/src/nvim/os_unix.c
+++ b/src/nvim/os_unix.c
@@ -102,36 +102,6 @@ void mch_write(char_u *s, int len)
}
/*
- * A simplistic version of setjmp() that only allows one level of using.
- * Don't call twice before calling mch_endjmp()!.
- * Usage:
- * mch_startjmp();
- * if (SETJMP(lc_jump_env) != 0)
- * {
- * mch_didjmp();
- * EMSG("crash!");
- * }
- * else
- * {
- * do_the_work;
- * mch_endjmp();
- * }
- * Note: Can't move SETJMP() here, because a function calling setjmp() must
- * not return before the saved environment is used.
- * Returns OK for normal return, FAIL when the protected code caused a
- * problem and LONGJMP() was used.
- */
-void mch_startjmp()
-{
- lc_active = TRUE;
-}
-
-void mch_endjmp()
-{
- lc_active = FALSE;
-}
-
-/*
* If the machine has job control, use it to suspend the program,
* otherwise fake it by starting a new shell.
*/
@@ -1490,158 +1460,3 @@ static int have_dollars(int num, char_u **file)
return TRUE;
return FALSE;
}
-
-#if defined(FEAT_LIBCALL) || defined(PROTO)
-typedef char_u * (*STRPROCSTR)(char_u *);
-typedef char_u * (*INTPROCSTR)(int);
-typedef int (*STRPROCINT)(char_u *);
-typedef int (*INTPROCINT)(int);
-
-/*
- * Call a DLL routine which takes either a string or int param
- * and returns an allocated string.
- */
-int mch_libcall(char_u *libname,
- char_u *funcname,
- char_u *argstring, /* NULL when using an argint */
- int argint,
- char_u **string_result, /* NULL when using number_result */
- int *number_result)
-{
-# if defined(USE_DLOPEN)
- void *hinstLib;
- char *dlerr = NULL;
-# else
- shl_t hinstLib;
-# endif
- STRPROCSTR ProcAdd;
- INTPROCSTR ProcAddI;
- char_u *retval_str = NULL;
- int retval_int = 0;
- int success = FALSE;
-
- /*
- * Get a handle to the DLL module.
- */
-# if defined(USE_DLOPEN)
- /* First clear any error, it's not cleared by the dlopen() call. */
- (void)dlerror();
-
- hinstLib = dlopen((char *)libname, RTLD_LAZY
-# ifdef RTLD_LOCAL
- | RTLD_LOCAL
-# endif
- );
- if (hinstLib == NULL) {
- /* "dlerr" must be used before dlclose() */
- dlerr = (char *)dlerror();
- if (dlerr != NULL)
- EMSG2(_("dlerror = \"%s\""), dlerr);
- }
-# else
- hinstLib = shl_load((const char*)libname, BIND_IMMEDIATE|BIND_VERBOSE, 0L);
-# endif
-
- /* If the handle is valid, try to get the function address. */
- if (hinstLib != NULL) {
- /*
- * Catch a crash when calling the library function. For example when
- * using a number where a string pointer is expected.
- */
- mch_startjmp();
- if (SETJMP(lc_jump_env) != 0) {
- success = FALSE;
-# if defined(USE_DLOPEN)
- dlerr = NULL;
-# endif
- } else
- {
- retval_str = NULL;
- retval_int = 0;
-
- if (argstring != NULL) {
-# if defined(USE_DLOPEN)
- ProcAdd = (STRPROCSTR)dlsym(hinstLib, (const char *)funcname);
- dlerr = (char *)dlerror();
-# else
- if (shl_findsym(&hinstLib, (const char *)funcname,
- TYPE_PROCEDURE, (void *)&ProcAdd) < 0)
- ProcAdd = NULL;
-# endif
- if ((success = (ProcAdd != NULL
-# if defined(USE_DLOPEN)
- && dlerr == NULL
-# endif
- ))) {
- if (string_result == NULL)
- retval_int = ((STRPROCINT)ProcAdd)(argstring);
- else
- retval_str = (ProcAdd)(argstring);
- }
- } else {
-# if defined(USE_DLOPEN)
- ProcAddI = (INTPROCSTR)dlsym(hinstLib, (const char *)funcname);
- dlerr = (char *)dlerror();
-# else
- if (shl_findsym(&hinstLib, (const char *)funcname,
- TYPE_PROCEDURE, (void *)&ProcAddI) < 0)
- ProcAddI = NULL;
-# endif
- if ((success = (ProcAddI != NULL
-# if defined(USE_DLOPEN)
- && dlerr == NULL
-# endif
- ))) {
- if (string_result == NULL)
- retval_int = ((INTPROCINT)ProcAddI)(argint);
- else
- retval_str = (ProcAddI)(argint);
- }
- }
-
- /* Save the string before we free the library. */
- /* Assume that a "1" or "-1" result is an illegal pointer. */
- if (string_result == NULL)
- *number_result = retval_int;
- else if (retval_str != NULL
- && retval_str != (char_u *)1
- && retval_str != (char_u *)-1)
- *string_result = vim_strsave(retval_str);
- }
-
- mch_endjmp();
-# ifdef SIGHASARG
- if (lc_signal != 0) {
- int i;
-
- /* try to find the name of this signal */
- for (i = 0; signal_info[i].sig != -1; i++)
- if (lc_signal == signal_info[i].sig)
- break;
- EMSG2("E368: got SIG%s in libcall()", signal_info[i].name);
- }
-# endif
-
-# if defined(USE_DLOPEN)
- /* "dlerr" must be used before dlclose() */
- if (dlerr != NULL)
- EMSG2(_("dlerror = \"%s\""), dlerr);
-
- /* Free the DLL module. */
- (void)dlclose(hinstLib);
-# else
- (void)shl_unload(hinstLib);
-# endif
- }
-
- if (!success) {
- EMSG2(_(e_libcall), funcname);
- return FAIL;
- }
-
- return OK;
-}
-#endif
-
-
-
diff --git a/src/nvim/os_unix_defs.h b/src/nvim/os_unix_defs.h
index ebecca3aae..6a3934b0c8 100644
--- a/src/nvim/os_unix_defs.h
+++ b/src/nvim/os_unix_defs.h
@@ -262,17 +262,6 @@
# include <strings.h>
#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() */
/* We have three kinds of ACL support. */