Mercurial > vim
changeset 28771:cf9f5b5c8079 v8.2.4910
patch 8.2.4910: imperfect coding
Commit: https://github.com/vim/vim/commit/9ff7d717aa3176de5c61de340deb93f41c7780fc
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 7 17:45:16 2022 +0100
patch 8.2.4910: imperfect coding
Problem: Imperfect coding.
Solution: Make code nicer.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 07 May 2022 19:00:03 +0200 |
parents | c475992c9bee |
children | 7b07ca0bb292 |
files | src/ex_getln.c src/version.c |
diffstat | 2 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -4130,7 +4130,7 @@ get_cmdline_completion(void) return NULL; p = get_ccline_ptr(); - if (p && p->xpc != NULL) + if (p != NULL && p->xpc != NULL) { char_u *cmd_compl; @@ -4138,7 +4138,7 @@ get_cmdline_completion(void) cmd_compl = cmdcomplete_type_to_str(p->xpc->xp_context); if (cmd_compl != NULL) - return vim_strnsave(cmd_compl, strlen((char *)cmd_compl)); + return vim_strsave(cmd_compl); } return NULL;