aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2019-12-15 21:00:57 -0500
committerJames McCoy <jamessan@jamessan.com>2019-12-15 21:17:00 -0500
commit9c4223215f71e1212462ada4e698be1b31437dd9 (patch)
treec5f55c47f2398f0f048bcd6e19dd592542aa4c15
parente2cc5fe09d98ce1ccaaa666a835c896805ccc196 (diff)
downloadrneovim-9c4223215f71e1212462ada4e698be1b31437dd9.tar.gz
rneovim-9c4223215f71e1212462ada4e698be1b31437dd9.tar.bz2
rneovim-9c4223215f71e1212462ada4e698be1b31437dd9.zip
libcallnr: Use int, not int64_t, as the return type for Vim compat
Vim's documentation simply states that libcallnr() should be used "for a function that returns an int". Based on the tests, code, and common syscall interfaces, this should likely be taken literally instead of trying to apply some well-defined type lipstick. Notably, this change fixes Test_libcall_libcallnr on hppa (a 32-bit big-endian system).
-rw-r--r--src/nvim/eval.c8
-rw-r--r--src/nvim/os/dl.c8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 1f753608d2..e39f36957c 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -12651,7 +12651,7 @@ static void libcall_common(typval_T *argvars, typval_T *rettv, int out_type)
const char *libname = (char *) argvars[0].vval.v_string;
const char *funcname = (char *) argvars[1].vval.v_string;
- int in_type = argvars[2].v_type;
+ VarType in_type = argvars[2].v_type;
// input variables
char *str_in = (in_type == VAR_STRING)
@@ -12660,8 +12660,8 @@ static void libcall_common(typval_T *argvars, typval_T *rettv, int out_type)
// output variables
char **str_out = (out_type == VAR_STRING)
- ? (char **) &rettv->vval.v_string : NULL;
- int64_t int_out = 0;
+ ? (char **)&rettv->vval.v_string : NULL;
+ int int_out = 0;
bool success = os_libcall(libname, funcname,
str_in, int_in,
@@ -12673,7 +12673,7 @@ static void libcall_common(typval_T *argvars, typval_T *rettv, int out_type)
}
if (out_type == VAR_NUMBER) {
- rettv->vval.v_number = (int) int_out;
+ rettv->vval.v_number = (varnumber_T)int_out;
}
}
diff --git a/src/nvim/os/dl.c b/src/nvim/os/dl.c
index f0fadb16f2..2783411574 100644
--- a/src/nvim/os/dl.c
+++ b/src/nvim/os/dl.c
@@ -19,15 +19,15 @@
/// string -> int
typedef void (*gen_fn)(void);
typedef const char *(*str_str_fn)(const char *str);
-typedef int64_t (*str_int_fn)(const char *str);
+typedef int (*str_int_fn)(const char *str);
typedef const char *(*int_str_fn)(int64_t i);
-typedef int64_t (*int_int_fn)(int64_t i);
+typedef int (*int_int_fn)(int64_t i);
/// os_libcall - call a function in a dynamic loadable library
///
/// an example of calling a function that takes a string and returns an int:
///
-/// int64_t int_out = 0;
+/// int int_out = 0;
/// os_libcall("mylib.so", "somefn", "string-argument", 0, NULL, &int_out);
///
/// @param libname the name of the library to load (e.g.: libsomething.so)
@@ -43,7 +43,7 @@ bool os_libcall(const char *libname,
const char *argv,
int64_t argi,
char **str_out,
- int64_t *int_out)
+ int *int_out)
{
if (!libname || !funcname) {
return false;