Skip to content

Commit

Permalink
[release-0.4] libcallnr: Use int, not int64_t, as the return t… (neov…
Browse files Browse the repository at this point in the history
…im#11566)

[release-0.4] libcallnr: Use int, not int64_t, as the return type for Vim compat
  • Loading branch information
jamessan authored Dec 16, 2019
2 parents 972dd75 + ef71c89 commit fafd636
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/nvim/eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand All @@ -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;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/nvim/os/dl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit fafd636

Please sign in to comment.