patch 9.1.1169: using global variable for get_insert()/get_lambda_name()
Problem: using global variable for get_insert()/get_lambda_name()
(after v9.1.1151)
Solution: let the functions return a string_T object instead
(Yee Cheng Chin)
In #16720, `get_insert()` was modified to store a string length in a
global variable to be queried immediately by another `get_insert_len()`
function, which is somewhat fragile. Instead, just have the function
itself return a `string_T` object instead. Also do the same for
`get_lambda_name()` which has similar issues.
closes: #16775
Signed-off-by: Yee Cheng Chin <ychin.git@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/proto/getchar.pro b/src/proto/getchar.pro
index c1eb1ab..11a37fb 100644
--- a/src/proto/getchar.pro
+++ b/src/proto/getchar.pro
@@ -1,7 +1,6 @@
/* getchar.c */
char_u *get_recorded(void);
-char_u *get_inserted(void);
-size_t get_inserted_len(void);
+string_T get_inserted(void);
int stuff_empty(void);
int readbuf1_empty(void);
void typeahead_noflush(int c);
diff --git a/src/proto/userfunc.pro b/src/proto/userfunc.pro
index a0f04b2..95d8cc4 100644
--- a/src/proto/userfunc.pro
+++ b/src/proto/userfunc.pro
@@ -2,8 +2,7 @@
void func_init(void);
hashtab_T *func_tbl_get(void);
char_u *make_ufunc_name_readable(char_u *name, char_u *buf, size_t bufsize);
-char_u *get_lambda_name(void);
-size_t get_lambda_name_len(void);
+string_T get_lambda_name(void);
char_u *register_cfunc(cfunc_T cb, cfunc_free_T cb_free, void *state);
int get_lambda_tv(char_u **arg, typval_T *rettv, int types_optional, evalarg_T *evalarg);
char_u *deref_func_name(char_u *name, int *lenp, partial_T **partialp, type_T **type, int no_autoload, int new_function, int *found_var);