aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/ex_getln.c12
-rw-r--r--src/nvim/vim.h1
2 files changed, 4 insertions, 9 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index a0910f1394..129cb323ea 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -4229,17 +4229,11 @@ ExpandOne (
* Prepare an expand structure for use.
*/
void ExpandInit(expand_T *xp)
+ FUNC_ATTR_NONNULL_ALL
{
- xp->xp_pattern = NULL;
- xp->xp_pattern_len = 0;
+ CLEAR_POINTER(xp);
xp->xp_backslash = XP_BS_NONE;
-#ifndef BACKSLASH_IN_FILENAME
- xp->xp_shell = FALSE;
-#endif
xp->xp_numfiles = -1;
- xp->xp_files = NULL;
- xp->xp_arg = NULL;
- xp->xp_line = NULL;
}
/*
@@ -5399,7 +5393,7 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file,
}
/// Call "user_expand_func()" to invoke a user defined Vim script function and
-/// return the result (either a string or a List).
+/// return the result (either a string, a List or NULL).
static void * call_user_expand_func(user_expand_func_T user_expand_func,
expand_T *xp, int *num_file, char_u ***file)
FUNC_ATTR_NONNULL_ALL
diff --git a/src/nvim/vim.h b/src/nvim/vim.h
index 900f2acd81..01f20cf29a 100644
--- a/src/nvim/vim.h
+++ b/src/nvim/vim.h
@@ -208,6 +208,7 @@ enum { FOLD_TEXT_LEN = 51 }; //!< buffer size for get_foldtext()
// Size in bytes of the hash used in the undo file.
#define UNDO_HASH_SIZE 32
+#define CLEAR_POINTER(ptr) memset((ptr), 0, sizeof(*(ptr)))
// defines to avoid typecasts from (char_u *) to (char *) and back
// (vim_strchr() is now in strings.c)