|
Karsten Hopp |
b427dd |
To: vim_dev@googlegroups.com
|
|
Karsten Hopp |
b427dd |
Subject: Patch 7.4.272
|
|
Karsten Hopp |
b427dd |
Fcc: outbox
|
|
Karsten Hopp |
b427dd |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
b427dd |
Mime-Version: 1.0
|
|
Karsten Hopp |
b427dd |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
b427dd |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
b427dd |
------------
|
|
Karsten Hopp |
b427dd |
|
|
Karsten Hopp |
b427dd |
Patch 7.4.272
|
|
Karsten Hopp |
b427dd |
Problem: Using just "$" does not cause an error message.
|
|
Karsten Hopp |
b427dd |
Solution: Check for empty environment variable name. (Christian Brabandt)
|
|
Karsten Hopp |
b427dd |
Files: src/eval.c, src/testdir/test_eval.in, src/testdir/test_eval.ok
|
|
Karsten Hopp |
b427dd |
|
|
Karsten Hopp |
b427dd |
|
|
Karsten Hopp |
b427dd |
*** ../vim-7.4.271/src/eval.c 2014-04-29 14:02:42.543919791 +0200
|
|
Karsten Hopp |
b427dd |
--- src/eval.c 2014-04-29 17:33:40.575697949 +0200
|
|
Karsten Hopp |
b427dd |
***************
|
|
Karsten Hopp |
b427dd |
*** 7798,7804 ****
|
|
Karsten Hopp |
b427dd |
* Get the value of an environment variable.
|
|
Karsten Hopp |
b427dd |
* "arg" is pointing to the '$'. It is advanced to after the name.
|
|
Karsten Hopp |
b427dd |
* If the environment variable was not set, silently assume it is empty.
|
|
Karsten Hopp |
b427dd |
! * Always return OK.
|
|
Karsten Hopp |
b427dd |
*/
|
|
Karsten Hopp |
b427dd |
static int
|
|
Karsten Hopp |
b427dd |
get_env_tv(arg, rettv, evaluate)
|
|
Karsten Hopp |
b427dd |
--- 7798,7804 ----
|
|
Karsten Hopp |
b427dd |
* Get the value of an environment variable.
|
|
Karsten Hopp |
b427dd |
* "arg" is pointing to the '$'. It is advanced to after the name.
|
|
Karsten Hopp |
b427dd |
* If the environment variable was not set, silently assume it is empty.
|
|
Karsten Hopp |
b427dd |
! * Return FAIL if the name is invalid.
|
|
Karsten Hopp |
b427dd |
*/
|
|
Karsten Hopp |
b427dd |
static int
|
|
Karsten Hopp |
b427dd |
get_env_tv(arg, rettv, evaluate)
|
|
Karsten Hopp |
b427dd |
***************
|
|
Karsten Hopp |
b427dd |
*** 7817,7848 ****
|
|
Karsten Hopp |
b427dd |
len = get_env_len(arg);
|
|
Karsten Hopp |
b427dd |
if (evaluate)
|
|
Karsten Hopp |
b427dd |
{
|
|
Karsten Hopp |
b427dd |
! if (len != 0)
|
|
Karsten Hopp |
b427dd |
{
|
|
Karsten Hopp |
b427dd |
! cc = name[len];
|
|
Karsten Hopp |
b427dd |
! name[len] = NUL;
|
|
Karsten Hopp |
b427dd |
! /* first try vim_getenv(), fast for normal environment vars */
|
|
Karsten Hopp |
b427dd |
! string = vim_getenv(name, &mustfree);
|
|
Karsten Hopp |
b427dd |
! if (string != NULL && *string != NUL)
|
|
Karsten Hopp |
b427dd |
! {
|
|
Karsten Hopp |
b427dd |
! if (!mustfree)
|
|
Karsten Hopp |
b427dd |
! string = vim_strsave(string);
|
|
Karsten Hopp |
b427dd |
! }
|
|
Karsten Hopp |
b427dd |
! else
|
|
Karsten Hopp |
b427dd |
! {
|
|
Karsten Hopp |
b427dd |
! if (mustfree)
|
|
Karsten Hopp |
b427dd |
! vim_free(string);
|
|
Karsten Hopp |
b427dd |
|
|
Karsten Hopp |
b427dd |
! /* next try expanding things like $VIM and ${HOME} */
|
|
Karsten Hopp |
b427dd |
! string = expand_env_save(name - 1);
|
|
Karsten Hopp |
b427dd |
! if (string != NULL && *string == '$')
|
|
Karsten Hopp |
b427dd |
! {
|
|
Karsten Hopp |
b427dd |
! vim_free(string);
|
|
Karsten Hopp |
b427dd |
! string = NULL;
|
|
Karsten Hopp |
b427dd |
! }
|
|
Karsten Hopp |
b427dd |
}
|
|
Karsten Hopp |
b427dd |
- name[len] = cc;
|
|
Karsten Hopp |
b427dd |
}
|
|
Karsten Hopp |
b427dd |
rettv->v_type = VAR_STRING;
|
|
Karsten Hopp |
b427dd |
rettv->vval.v_string = string;
|
|
Karsten Hopp |
b427dd |
}
|
|
Karsten Hopp |
b427dd |
--- 7817,7849 ----
|
|
Karsten Hopp |
b427dd |
len = get_env_len(arg);
|
|
Karsten Hopp |
b427dd |
if (evaluate)
|
|
Karsten Hopp |
b427dd |
{
|
|
Karsten Hopp |
b427dd |
! if (len == 0)
|
|
Karsten Hopp |
b427dd |
! return FAIL; /* can't be an environment variable */
|
|
Karsten Hopp |
b427dd |
!
|
|
Karsten Hopp |
b427dd |
! cc = name[len];
|
|
Karsten Hopp |
b427dd |
! name[len] = NUL;
|
|
Karsten Hopp |
b427dd |
! /* first try vim_getenv(), fast for normal environment vars */
|
|
Karsten Hopp |
b427dd |
! string = vim_getenv(name, &mustfree);
|
|
Karsten Hopp |
b427dd |
! if (string != NULL && *string != NUL)
|
|
Karsten Hopp |
b427dd |
{
|
|
Karsten Hopp |
b427dd |
! if (!mustfree)
|
|
Karsten Hopp |
b427dd |
! string = vim_strsave(string);
|
|
Karsten Hopp |
b427dd |
! }
|
|
Karsten Hopp |
b427dd |
! else
|
|
Karsten Hopp |
b427dd |
! {
|
|
Karsten Hopp |
b427dd |
! if (mustfree)
|
|
Karsten Hopp |
b427dd |
! vim_free(string);
|
|
Karsten Hopp |
b427dd |
|
|
Karsten Hopp |
b427dd |
! /* next try expanding things like $VIM and ${HOME} */
|
|
Karsten Hopp |
b427dd |
! string = expand_env_save(name - 1);
|
|
Karsten Hopp |
b427dd |
! if (string != NULL && *string == '$')
|
|
Karsten Hopp |
b427dd |
! {
|
|
Karsten Hopp |
b427dd |
! vim_free(string);
|
|
Karsten Hopp |
b427dd |
! string = NULL;
|
|
Karsten Hopp |
b427dd |
}
|
|
Karsten Hopp |
b427dd |
}
|
|
Karsten Hopp |
b427dd |
+ name[len] = cc;
|
|
Karsten Hopp |
b427dd |
+
|
|
Karsten Hopp |
b427dd |
rettv->v_type = VAR_STRING;
|
|
Karsten Hopp |
b427dd |
rettv->vval.v_string = string;
|
|
Karsten Hopp |
b427dd |
}
|
|
Karsten Hopp |
b427dd |
*** ../vim-7.4.271/src/testdir/test_eval.in 2014-04-29 14:02:42.543919791 +0200
|
|
Karsten Hopp |
b427dd |
--- src/testdir/test_eval.in 2014-04-29 17:35:27.243696080 +0200
|
|
Karsten Hopp |
b427dd |
***************
|
|
Karsten Hopp |
b427dd |
*** 183,188 ****
|
|
Karsten Hopp |
b427dd |
--- 183,195 ----
|
|
Karsten Hopp |
b427dd |
:" script-local function used in Funcref must exist.
|
|
Karsten Hopp |
b427dd |
:so test_eval_func.vim
|
|
Karsten Hopp |
b427dd |
:"
|
|
Karsten Hopp |
b427dd |
+ :" Using $ instead of '$' must give an error
|
|
Karsten Hopp |
b427dd |
+ :try
|
|
Karsten Hopp |
b427dd |
+ : call append($, 'foobar')
|
|
Karsten Hopp |
b427dd |
+ :catch
|
|
Karsten Hopp |
b427dd |
+ :$put =v:exception
|
|
Karsten Hopp |
b427dd |
+ :endtry
|
|
Karsten Hopp |
b427dd |
+ :"
|
|
Karsten Hopp |
b427dd |
:/^start:/+1,$wq! test.out
|
|
Karsten Hopp |
b427dd |
:" vim: et ts=4 isk-=\: fmr=???,???
|
|
Karsten Hopp |
b427dd |
:call getchar()
|
|
Karsten Hopp |
b427dd |
*** ../vim-7.4.271/src/testdir/test_eval.ok 2014-04-29 14:02:42.543919791 +0200
|
|
Karsten Hopp |
b427dd |
--- src/testdir/test_eval.ok 2014-04-29 17:36:41.451694779 +0200
|
|
Karsten Hopp |
b427dd |
***************
|
|
Karsten Hopp |
b427dd |
*** 345,347 ****
|
|
Karsten Hopp |
b427dd |
--- 345,348 ----
|
|
Karsten Hopp |
b427dd |
func s:Testje exists: 1
|
|
Karsten Hopp |
b427dd |
Bar exists: 1
|
|
Karsten Hopp |
b427dd |
func Bar exists: 1
|
|
Karsten Hopp |
b427dd |
+ Vim(call):E116: Invalid arguments for function append
|
|
Karsten Hopp |
b427dd |
*** ../vim-7.4.271/src/version.c 2014-04-29 15:55:39.443801021 +0200
|
|
Karsten Hopp |
b427dd |
--- src/version.c 2014-04-29 17:31:54.203699814 +0200
|
|
Karsten Hopp |
b427dd |
***************
|
|
Karsten Hopp |
b427dd |
*** 736,737 ****
|
|
Karsten Hopp |
b427dd |
--- 736,739 ----
|
|
Karsten Hopp |
b427dd |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
b427dd |
+ /**/
|
|
Karsten Hopp |
b427dd |
+ 272,
|
|
Karsten Hopp |
b427dd |
/**/
|
|
Karsten Hopp |
b427dd |
|
|
Karsten Hopp |
b427dd |
--
|
|
Karsten Hopp |
b427dd |
From "know your smileys":
|
|
Karsten Hopp |
b427dd |
C=}>;*{)) Drunk, devilish chef with a toupee in an updraft,
|
|
Karsten Hopp |
b427dd |
a mustache, and a double chin
|
|
Karsten Hopp |
b427dd |
|
|
Karsten Hopp |
b427dd |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
b427dd |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
b427dd |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
Karsten Hopp |
b427dd |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|