summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2006-05-05 21:18:03 +0000
committerBram Moolenaar <Bram@vim.org>2006-05-05 21:18:03 +0000
commit79783449725290436eff22548f676822640f88ec (patch)
tree3ac4aab491e8c59eb070c76c370c599e650d4c46 /src/eval.c
parent9635157db0d9a4d45abdafa2cb0781cf7e0c7fd6 (diff)
downloadvim-79783449725290436eff22548f676822640f88ec.zip
updated for version 7.0g04
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c
index b01c5e079..20d9c91e1 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -8791,7 +8791,11 @@ f_exists(argvars, rettv)
}
}
else if (*p == '&' || *p == '+') /* option */
+ {
n = (get_option_tv(&p, NULL, TRUE) == OK);
+ if (*skipwhite(p) != NUL)
+ n = FALSE; /* trailing garbage */
+ }
else if (*p == '*') /* internal or user defined function */
{
n = function_exists(p + 1);
@@ -8830,6 +8834,8 @@ f_exists(argvars, rettv)
clear_tv(&tv);
}
}
+ if (*p != NUL)
+ n = FALSE;
vim_free(tofree);
}
@@ -19109,14 +19115,18 @@ function_exists(name)
int n = FALSE;
p = trans_function_name(&nm, FALSE, TFN_INT|TFN_QUIET, NULL);
- if (p != NULL)
+ nm = skipwhite(nm);
+
+ /* Only accept "funcname", "funcname ", "funcname (..." and
+ * "funcname(...", not "funcname!...". */
+ if (p != NULL && (*nm == NUL || *nm == '('))
{
if (builtin_function(p))
n = (find_internal_func(p) >= 0);
else
n = (find_func(p) != NULL);
- vim_free(p);
}
+ vim_free(p);
return n;
}