-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On July 25, 2014 11:04:09 PM GMT+03:00, Jacob Niehus <jacob.nie...@gmail.com> 
wrote:
>I think this is a useful function to allow different mappings depending
>on the type of command window (ex, search, input, etc.). I can add
>documentation if people agree.
>
>-Jake
>
>diff --git a/src/eval.c b/src/eval.c
>--- a/src/eval.c
>+++ b/src/eval.c
>@@ -554,6 +554,7 @@
> static void f_getcmdline __ARGS((typval_T *argvars, typval_T *rettv));
> static void f_getcmdpos __ARGS((typval_T *argvars, typval_T *rettv));
> static void f_getcmdtype __ARGS((typval_T *argvars, typval_T *rettv));
>+static void f_getcmdwintype __ARGS((typval_T *argvars, typval_T
>*rettv));
> static void f_getcwd __ARGS((typval_T *argvars, typval_T *rettv));
>static void f_getfontname __ARGS((typval_T *argvars, typval_T *rettv));
> static void f_getfperm __ARGS((typval_T *argvars, typval_T *rettv));
>@@ -7984,6 +7985,7 @@
>     {"getcmdline",    0, 0, f_getcmdline},
>     {"getcmdpos",     0, 0, f_getcmdpos},
>     {"getcmdtype",    0, 0, f_getcmdtype},
>+    {"getcmdwintype", 0, 0, f_getcmdwintype},
>     {"getcurpos",     0, 0, f_getcurpos},
>     {"getcwd",                0, 0, f_getcwd},
>     {"getfontname",   0, 1, f_getfontname},
>@@ -11503,6 +11505,26 @@
> }
>
> /*
>+ * "getcmdwintype()" function
>+ */
>+    static void
>+f_getcmdwintype(argvars, rettv)
>+    typval_T  *argvars UNUSED;
>+    typval_T  *rettv;
>+{
>+    rettv->v_type = VAR_STRING;
>+    rettv->vval.v_string = NULL;
>+#ifdef FEAT_CMDWIN
>+    rettv->vval.v_string = alloc(2);

I think there is at least one compiler or static analyzer among used to compile 
or check Vim which will complain here. You should move = NULL to #else.

>+    if (rettv->vval.v_string != NULL)
>+    {
>+      rettv->vval.v_string[0] = cmdwin_type;
>+      rettv->vval.v_string[1] = NUL;
>+    }

If I am not mistaking the whole alloc+if sequence may be replaced with 
vim_strnsave(&cmdwin_type, 1). Though this is kinda hack, you should probably 
ignore the suggestion.

>+#endif
>+}
>+
>+/*
>  * "getcwd()" function
>  */
>     static void

-----BEGIN PGP SIGNATURE-----
Version: APG v1.1.1

iQI1BAEBCgAfBQJT0vPfGBxaeVggPHp5eC52aW1AZ21haWwuY29tPgAKCRCf3UKj
HhHSvo5+D/93YSMDrtzhOiZBlKc+2FbHQBOSU0rvrOx5Vkex39f/mk+AmeLJH1tv
wAgQG9iHIVlTIV6FyhwhmP1Muq6NuejlVSUQMnIJEhEscw+1trRIasP8xq8/EyyW
TpiTVQkvzRR0glBM1kg3rh+KhUIKy7dqGTjtxFDSVd00BzLG5365q7roLeCrF0ep
j6pGbz0vP6obtU00++tVOJErb5Uzk5OkgixWDweqAzg7ri/Hu+piUGCTIILuBx2V
m05DQAmdTs9SySZQSXeuGhcbVlP8iZkMp/MPMSYQf/Wb9VvdMVimeBUeLMUyC3Bs
u1F5hgRrgV735ra6hzwdAlTP1EiaB/hD2dKqw+QQmwpD9u/xDlnGC25emlWpBGbx
BbN/pdSiAbBz7LTUDFoLX+mFEUYq8XbuxI/qqowzm7CcVUCVWx5l1Ykcfzca1P/w
fMeuP3IWfU4z7igCapd5r2PsMHCxWJOzdeTjvsh+y/EBKryV5H4QJMkrwb24VqfA
l6NSu11mWB10SKzoIZn/c8xEFkYlIUxiH6eQjaqqSCMCWwIgcHeKy9orkZ+JF4tl
nkh+ee+0vser/Dje8HPguG8N5L+v+3zA6IZtRHDzj5TROq6Z7Fnm04E4Ky4YXTK9
4HfLT7L4kzZlG/xW2wo5iQvjsMmol+smowa72Ck5ltA/b9lE2Lz2PA==
=oV3V
-----END PGP SIGNATURE-----

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui