Mercurial > vim
comparison src/filepath.c @ 23175:d7294a6220ac v8.2.2133
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Commit: https://github.com/vim/vim/commit/2a9d5d386bea8455b37c1accebc45683ec51d6fb
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Dec 12 18:58:40 2020 +0100
patch 8.2.2133: Vim9: checking for a non-empty string is too strict
Problem: Vim9: checking for a non-empty string is too strict.
Solution: Check for any string. (closes https://github.com/vim/vim/issues/7447)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 12 Dec 2020 19:00:03 +0100 |
parents | 5f08d4a42898 |
children | 5f69af863502 |
comparison
equal
deleted
inserted
replaced
23174:85cc3693b016 | 23175:d7294a6220ac |
---|---|
874 void | 874 void |
875 f_exepath(typval_T *argvars, typval_T *rettv) | 875 f_exepath(typval_T *argvars, typval_T *rettv) |
876 { | 876 { |
877 char_u *p = NULL; | 877 char_u *p = NULL; |
878 | 878 |
879 if (in_vim9script() && check_for_string(&argvars[0]) == FAIL) | 879 if (in_vim9script() && check_for_nonempty_string(&argvars[0]) == FAIL) |
880 return; | 880 return; |
881 (void)mch_can_exe(tv_get_string(&argvars[0]), &p, TRUE); | 881 (void)mch_can_exe(tv_get_string(&argvars[0]), &p, TRUE); |
882 rettv->v_type = VAR_STRING; | 882 rettv->v_type = VAR_STRING; |
883 rettv->vval.v_string = p; | 883 rettv->vval.v_string = p; |
884 } | 884 } |
940 int error = FALSE; | 940 int error = FALSE; |
941 #endif | 941 #endif |
942 | 942 |
943 rettv->vval.v_string = NULL; | 943 rettv->vval.v_string = NULL; |
944 rettv->v_type = VAR_STRING; | 944 rettv->v_type = VAR_STRING; |
945 if (in_vim9script() && check_for_string(&argvars[0]) == FAIL) | 945 if (in_vim9script() && check_for_nonempty_string(&argvars[0]) == FAIL) |
946 return; | 946 return; |
947 | 947 |
948 #ifdef FEAT_SEARCHPATH | 948 #ifdef FEAT_SEARCHPATH |
949 fname = tv_get_string(&argvars[0]); | 949 fname = tv_get_string(&argvars[0]); |
950 | 950 |
1026 if (in_vim9script() && (check_for_string(&argvars[0]) == FAIL | 1026 if (in_vim9script() && (check_for_string(&argvars[0]) == FAIL |
1027 || check_for_string(&argvars[1]) == FAIL)) | 1027 || check_for_string(&argvars[1]) == FAIL)) |
1028 return; | 1028 return; |
1029 fname = tv_get_string_chk(&argvars[0]); | 1029 fname = tv_get_string_chk(&argvars[0]); |
1030 mods = tv_get_string_buf_chk(&argvars[1], buf); | 1030 mods = tv_get_string_buf_chk(&argvars[1], buf); |
1031 if (fname == NULL || mods == NULL) | 1031 if (fname == NULL) |
1032 fname = NULL; | 1032 fname = NULL; |
1033 else | 1033 else if (mods != NULL && *mods != NUL) |
1034 { | 1034 { |
1035 len = (int)STRLEN(fname); | 1035 len = (int)STRLEN(fname); |
1036 (void)modify_fname(mods, FALSE, &usedlen, &fname, &fbuf, &len); | 1036 (void)modify_fname(mods, FALSE, &usedlen, &fname, &fbuf, &len); |
1037 } | 1037 } |
1038 | 1038 |