Compare commits

...

6 Commits

Author SHA1 Message Date
Bram Moolenaar
c047b9a49f updated for version 7.3.435
Problem:    Compiler warning for unused variable.
Solution:   Move the variable inside #ifdef.
2012-02-11 20:40:55 +01:00
Bram Moolenaar
3fe37d62d1 updated for version 7.3.434
Problem:    Using join() can be slow.
Solution:   Compute the size of the result before allocation to avoid a lot of
            allocations and copies. (Taro Muraoka)
2012-02-06 00:13:22 +01:00
Bram Moolenaar
b3a6bbc7b6 updated for version 7.3.433
Problem:    Using continued lines in a Vim script can be slow.
Solution:   Instead of reallocating for every line use a growarray. (Yasuhiro
            Matsumoto)
2012-02-05 23:10:30 +01:00
Bram Moolenaar
8d462f9666 updated for version 7.3.432
Problem:    ACLs are not supported for ZFS or NFSv4 on Solaris.
Solution:   Add configure check and code. (Danek Duvall)
2012-02-05 22:51:33 +01:00
Bram Moolenaar
a8c8a688ac updated for version 7.3.431
Problem:    Fetching a key at a prompt may be confused by escape sequences.
            Especially when getting a prompt at a VimEnter autocommand.
            (Alex Efros)
Solution:   Properly handle escape sequences deleted by check_termcode().
2012-02-05 22:05:48 +01:00
Bram Moolenaar
73b2470896 updated for version 7.3.430
Problem:    When a custom filetype detection uses "augroup END" the conf
            fileytpe detection does not have the filetypedetect group.
Solution:   Always end the group and include filetypedetect in the conf
            autocommand. (Lech Lorens)
2012-02-05 20:08:36 +01:00
12 changed files with 251 additions and 63 deletions

View File

@@ -2545,17 +2545,19 @@ au BufNewFile,BufRead *.txt,*.text setf text
" detected filetypes.
runtime! ftdetect/*.vim
" NOTE: The above command could have ended the filetypedetect autocmd group
" and started another one. Let's make sure it has ended to get to a consistant
" state.
augroup END
" Generic configuration file (check this last, it's just guessing!)
au BufNewFile,BufRead,StdinReadPost *
au filetypedetect BufNewFile,BufRead,StdinReadPost *
\ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat
\ && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#'
\ || getline(4) =~ '^#' || getline(5) =~ '^#') |
\ setf conf |
\ endif
augroup END
" If the GUI is already running, may still need to install the Syntax menu.
" Don't do it when the 'M' flag is included in 'guioptions'.

44
src/auto/configure vendored
View File

@@ -11328,7 +11328,47 @@ fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Solaris ACL support" >&5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for acl_get in -lsec" >&5
$as_echo_n "checking for acl_get in -lsec... " >&6; }
if test "${ac_cv_lib_sec_acl_get+set}" = set; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lsec $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char acl_get ();
int
main ()
{
return acl_get ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_sec_acl_get=yes
else
ac_cv_lib_sec_acl_get=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sec_acl_get" >&5
$as_echo "$ac_cv_lib_sec_acl_get" >&6; }
if test "x$ac_cv_lib_sec_acl_get" = x""yes; then :
LIBS="$LIBS -lsec"; $as_echo "#define HAVE_SOLARIS_ZFS_ACL 1" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Solaris ACL support" >&5
$as_echo_n "checking for Solaris ACL support... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -11355,6 +11395,8 @@ $as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for AIX ACL support" >&5
$as_echo_n "checking for AIX ACL support... " >&6; }

View File

@@ -363,6 +363,7 @@
/* Define if you want to add support for ACL */
#undef HAVE_POSIX_ACL
#undef HAVE_SOLARIS_ZFS_ACL
#undef HAVE_SOLARIS_ACL
#undef HAVE_AIX_ACL

View File

@@ -3106,6 +3106,7 @@ AC_TRY_LINK([
dnl Link with -lposix1e for ACL stuff; if not found, try -lacl for SGI
dnl when -lacl works, also try to use -lattr (required for Debian).
dnl On Solaris, use the acl_get/set functions in libsec, if present.
AC_MSG_CHECKING(--disable-acl argument)
AC_ARG_ENABLE(acl,
[ --disable-acl Don't check for ACL support.],
@@ -3128,6 +3129,7 @@ acl_t acl;], [acl = acl_get_file("foo", ACL_TYPE_ACCESS);
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_POSIX_ACL),
AC_MSG_RESULT(no))
AC_CHECK_LIB(sec, acl_get, [LIBS="$LIBS -lsec"; AC_DEFINE(HAVE_SOLARIS_ZFS_ACL)],
AC_MSG_CHECKING(for Solaris ACL support)
AC_TRY_LINK([
#ifdef HAVE_SYS_ACL_H
@@ -3135,7 +3137,7 @@ AC_TRY_LINK([
#endif], [acl("foo", GETACLCNT, 0, NULL);
],
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SOLARIS_ACL),
AC_MSG_RESULT(no))
AC_MSG_RESULT(no)))
AC_MSG_CHECKING(for AIX ACL support)
AC_TRY_LINK([

View File

@@ -442,6 +442,7 @@ static int list_concat __ARGS((list_T *l1, list_T *l2, typval_T *tv));
static list_T *list_copy __ARGS((list_T *orig, int deep, int copyID));
static void list_remove __ARGS((list_T *l, listitem_T *item, listitem_T *item2));
static char_u *list2string __ARGS((typval_T *tv, int copyID));
static int list_join_inner __ARGS((garray_T *gap, list_T *l, char_u *sep, int echo_style, int copyID, garray_T *join_gap));
static int list_join __ARGS((garray_T *gap, list_T *l, char_u *sep, int echo, int copyID));
static int free_unref_items __ARGS((int copyID));
static void set_ref_in_ht __ARGS((hashtab_T *ht, int copyID));
@@ -6571,6 +6572,82 @@ list2string(tv, copyID)
return (char_u *)ga.ga_data;
}
typedef struct join_S {
char_u *s;
char_u *tofree;
} join_T;
static int
list_join_inner(gap, l, sep, echo_style, copyID, join_gap)
garray_T *gap; /* to store the result in */
list_T *l;
char_u *sep;
int echo_style;
int copyID;
garray_T *join_gap; /* to keep each list item string */
{
int i;
join_T *p;
int len;
int sumlen = 0;
int first = TRUE;
char_u *tofree;
char_u numbuf[NUMBUFLEN];
listitem_T *item;
char_u *s;
/* Stringify each item in the list. */
for (item = l->lv_first; item != NULL && !got_int; item = item->li_next)
{
if (echo_style)
s = echo_string(&item->li_tv, &tofree, numbuf, copyID);
else
s = tv2string(&item->li_tv, &tofree, numbuf, copyID);
if (s == NULL)
return FAIL;
len = (int)STRLEN(s);
sumlen += len;
ga_grow(join_gap, 1);
p = ((join_T *)join_gap->ga_data) + (join_gap->ga_len++);
if (tofree != NULL || s != numbuf)
{
p->s = s;
p->tofree = tofree;
}
else
{
p->s = vim_strnsave(s, len);
p->tofree = p->s;
}
line_breakcheck();
}
/* Allocate result buffer with its total size, avoid re-allocation and
* multiple copy operations. Add 2 for a tailing ']' and NUL. */
if (join_gap->ga_len >= 2)
sumlen += (int)STRLEN(sep) * (join_gap->ga_len - 1);
if (ga_grow(gap, sumlen + 2) == FAIL)
return FAIL;
for (i = 0; i < join_gap->ga_len && !got_int; ++i)
{
if (first)
first = FALSE;
else
ga_concat(gap, sep);
p = ((join_T *)join_gap->ga_data) + i;
if (p->s != NULL)
ga_concat(gap, p->s);
line_breakcheck();
}
return OK;
}
/*
* Join list "l" into a string in "*gap", using separator "sep".
* When "echo_style" is TRUE use String as echoed, otherwise as inside a List.
@@ -6584,31 +6661,27 @@ list_join(gap, l, sep, echo_style, copyID)
int echo_style;
int copyID;
{
int first = TRUE;
char_u *tofree;
char_u numbuf[NUMBUFLEN];
listitem_T *item;
char_u *s;
garray_T join_ga;
int retval;
join_T *p;
int i;
for (item = l->lv_first; item != NULL && !got_int; item = item->li_next)
ga_init2(&join_ga, (int)sizeof(join_T), l->lv_len);
retval = list_join_inner(gap, l, sep, echo_style, copyID, &join_ga);
/* Dispose each item in join_ga. */
if (join_ga.ga_data != NULL)
{
if (first)
first = FALSE;
else
ga_concat(gap, sep);
if (echo_style)
s = echo_string(&item->li_tv, &tofree, numbuf, copyID);
else
s = tv2string(&item->li_tv, &tofree, numbuf, copyID);
if (s != NULL)
ga_concat(gap, s);
vim_free(tofree);
if (s == NULL)
return FAIL;
line_breakcheck();
p = (join_T *)join_ga.ga_data;
for (i = 0; i < join_ga.ga_len; ++i)
{
vim_free(p->tofree);
++p;
}
ga_clear(&join_ga);
}
return OK;
return retval;
}
/*
@@ -13406,7 +13479,7 @@ get_maparg(argvars, rettv, exact)
char_u *rhs;
int mode;
int abbr = FALSE;
int get_dict = FALSE;
int get_dict = FALSE;
mapblock_T *mp;
int buffer_local;

View File

@@ -3400,7 +3400,7 @@ getsourceline(c, cookie, indent)
{
struct source_cookie *sp = (struct source_cookie *)cookie;
char_u *line;
char_u *p, *s;
char_u *p;
#ifdef FEAT_EVAL
/* If breakpoints have been added/deleted need to check for it. */
@@ -3439,28 +3439,40 @@ getsourceline(c, cookie, indent)
{
/* compensate for the one line read-ahead */
--sourcing_lnum;
for (;;)
/* Get the next line and concatenate it when it starts with a
* backslash. We always need to read the next line, keep it in
* sp->nextline. */
sp->nextline = get_one_sourceline(sp);
if (sp->nextline != NULL && *(p = skipwhite(sp->nextline)) == '\\')
{
sp->nextline = get_one_sourceline(sp);
if (sp->nextline == NULL)
break;
p = skipwhite(sp->nextline);
if (*p != '\\')
break;
s = alloc((unsigned)(STRLEN(line) + STRLEN(p)));
if (s == NULL) /* out of memory */
break;
STRCPY(s, line);
STRCAT(s, p + 1);
garray_T ga;
ga_init2(&ga, (int)sizeof(char_u), 200);
ga_concat(&ga, line);
ga_concat(&ga, p + 1);
for (;;)
{
vim_free(sp->nextline);
sp->nextline = get_one_sourceline(sp);
if (sp->nextline == NULL)
break;
p = skipwhite(sp->nextline);
if (*p != '\\')
break;
ga_concat(&ga, p + 1);
}
ga_append(&ga, NUL);
vim_free(line);
line = s;
vim_free(sp->nextline);
line = ga.ga_data;
}
}
#ifdef FEAT_MBYTE
if (line != NULL && sp->conv.vc_type != CONV_NONE)
{
char_u *s;
/* Convert the encoding of the script line. */
s = string_convert(&sp->conv, line, NULL);
if (s != NULL)

View File

@@ -2282,7 +2282,8 @@ vgetorpeek(advance)
typebuf.tb_off] == RM_YES))
&& !timedout)
{
keylen = check_termcode(max_mlen + 1, NULL, 0);
keylen = check_termcode(max_mlen + 1,
NULL, 0, NULL);
/* If no termcode matched but 'pastetoggle'
* matched partially it's like an incomplete key

View File

@@ -3105,8 +3105,9 @@ ask_yesno(str, direct)
int
get_keystroke()
{
#define CBUFLEN 151
char_u buf[CBUFLEN];
char_u *buf = NULL;
int buflen = 150;
int maxlen;
int len = 0;
int n;
int save_mapped_ctrl_c = mapped_ctrl_c;
@@ -3118,12 +3119,29 @@ get_keystroke()
cursor_on();
out_flush();
/* Leave some room for check_termcode() to insert a key code into (max
* 5 chars plus NUL). And fix_input_buffer() can triple the number of
* bytes. */
maxlen = (buflen - 6 - len) / 3;
if (buf == NULL)
buf = alloc(buflen);
else if (maxlen < 10)
{
/* Need some more space. This migth happen when receiving a long
* escape sequence. */
buflen += 100;
buf = vim_realloc(buf, buflen);
maxlen = (buflen - 6 - len) / 3;
}
if (buf == NULL)
{
do_outofmem_msg((long_u)buflen);
return ESC; /* panic! */
}
/* First time: blocking wait. Second time: wait up to 100ms for a
* terminal code to complete. Leave some room for check_termcode() to
* insert a key code into (max 5 chars plus NUL). And
* fix_input_buffer() can triple the number of bytes. */
n = ui_inchar(buf + len, (CBUFLEN - 6 - len) / 3,
len == 0 ? -1L : 100L, 0);
* terminal code to complete. */
n = ui_inchar(buf + len, maxlen, len == 0 ? -1L : 100L, 0);
if (n > 0)
{
/* Replace zero and CSI by a special key code. */
@@ -3135,7 +3153,7 @@ get_keystroke()
++waited; /* keep track of the waiting time */
/* Incomplete termcode and not timed out yet: get more characters */
if ((n = check_termcode(1, buf, len)) < 0
if ((n = check_termcode(1, buf, buflen, &len)) < 0
&& (!p_ttimeout || waited * 100L < (p_ttm < 0 ? p_tm : p_ttm)))
continue;
@@ -3203,7 +3221,7 @@ get_keystroke()
{
if (MB_BYTE2LEN(n) > len)
continue; /* more bytes to get */
buf[len >= CBUFLEN ? CBUFLEN - 1 : len] = NUL;
buf[len >= buflen ? buflen - 1 : len] = NUL;
n = (*mb_ptr2char)(buf);
}
#endif
@@ -3213,6 +3231,7 @@ get_keystroke()
#endif
break;
}
vim_free(buf);
mapped_ctrl_c = save_mapped_ctrl_c;
return n;

View File

@@ -2746,6 +2746,13 @@ mch_get_acl(fname)
#ifdef HAVE_POSIX_ACL
ret = (vim_acl_T)acl_get_file((char *)fname, ACL_TYPE_ACCESS);
#else
#ifdef HAVE_SOLARIS_ZFS_ACL
acl_t *aclent;
if (acl_get((char *)fname, 0, &aclent) < 0)
return NULL;
ret = (vim_acl_T)aclent;
#else
#ifdef HAVE_SOLARIS_ACL
vim_acl_solaris_T *aclent;
@@ -2791,6 +2798,7 @@ mch_get_acl(fname)
ret = (vim_acl_T)aclent;
#endif /* HAVE_AIX_ACL */
#endif /* HAVE_SOLARIS_ACL */
#endif /* HAVE_SOLARIS_ZFS_ACL */
#endif /* HAVE_POSIX_ACL */
return ret;
}
@@ -2808,6 +2816,9 @@ mch_set_acl(fname, aclent)
#ifdef HAVE_POSIX_ACL
acl_set_file((char *)fname, ACL_TYPE_ACCESS, (acl_t)aclent);
#else
#ifdef HAVE_SOLARIS_ZFS_ACL
acl_set((char *)fname, (acl_t *)aclent);
#else
#ifdef HAVE_SOLARIS_ACL
acl((char *)fname, SETACL, ((vim_acl_solaris_T *)aclent)->acl_cnt,
((vim_acl_solaris_T *)aclent)->acl_entry);
@@ -2816,6 +2827,7 @@ mch_set_acl(fname, aclent)
chacl((char *)fname, aclent, ((struct acl *)aclent)->acl_len);
#endif /* HAVE_AIX_ACL */
#endif /* HAVE_SOLARIS_ACL */
#endif /* HAVE_SOLARIS_ZFS_ACL */
#endif /* HAVE_POSIX_ACL */
}
@@ -2828,6 +2840,9 @@ mch_free_acl(aclent)
#ifdef HAVE_POSIX_ACL
acl_free((acl_t)aclent);
#else
#ifdef HAVE_SOLARIS_ZFS_ACL
acl_free((acl_t *)aclent);
#else
#ifdef HAVE_SOLARIS_ACL
free(((vim_acl_solaris_T *)aclent)->acl_entry);
free(aclent);
@@ -2836,6 +2851,7 @@ mch_free_acl(aclent)
free(aclent);
#endif /* HAVE_AIX_ACL */
#endif /* HAVE_SOLARIS_ACL */
#endif /* HAVE_SOLARIS_ZFS_ACL */
#endif /* HAVE_POSIX_ACL */
}
#endif

View File

@@ -50,7 +50,7 @@ char_u *find_termcode __ARGS((char_u *name));
char_u *get_termcode __ARGS((int i));
void del_termcode __ARGS((char_u *name));
void set_mouse_topline __ARGS((win_T *wp));
int check_termcode __ARGS((int max_offset, char_u *buf, int buflen));
int check_termcode __ARGS((int max_offset, char_u *buf, int bufsize, int *buflen));
char_u *replace_termcodes __ARGS((char_u *from, char_u **bufp, int from_part, int do_lt, int special));
int find_term_bykeys __ARGS((char_u *src));
void show_termcodes __ARGS((void));

View File

@@ -3785,14 +3785,16 @@ set_mouse_topline(wp)
* With a match, the match is removed, the replacement code is inserted in
* typebuf.tb_buf[] and the number of characters in typebuf.tb_buf[] is
* returned.
* When "buf" is not NULL, it is used instead of typebuf.tb_buf[]. "buflen" is
* then the length of the string in buf[].
* When "buf" is not NULL, buf[bufsize] is used instead of typebuf.tb_buf[].
* "buflen" is then the length of the string in buf[] and is updated for
* inserts and deletes.
*/
int
check_termcode(max_offset, buf, buflen)
check_termcode(max_offset, buf, bufsize, buflen)
int max_offset;
char_u *buf;
int buflen;
int bufsize;
int *buflen;
{
char_u *tp;
char_u *p;
@@ -3864,10 +3866,10 @@ check_termcode(max_offset, buf, buflen)
}
else
{
if (offset >= buflen)
if (offset >= *buflen)
break;
tp = buf + offset;
len = buflen - offset;
len = *buflen - offset;
}
/*
@@ -5002,12 +5004,18 @@ check_termcode(max_offset, buf, buflen)
if (extra < 0)
/* remove matched characters */
mch_memmove(buf + offset, buf + offset - extra,
(size_t)(buflen + offset + extra));
(size_t)(*buflen + offset + extra));
else if (extra > 0)
/* insert the extra space we need */
{
/* Insert the extra space we need. If there is insufficient
* space return -1. */
if (*buflen + extra + new_slen >= bufsize)
return -1;
mch_memmove(buf + offset + extra, buf + offset,
(size_t)(buflen - offset));
(size_t)(*buflen - offset));
}
mch_memmove(buf + offset, string, (size_t)new_slen);
*buflen = *buflen + extra + new_slen;
}
return retval == 0 ? (len + extra + offset) : retval;
}

View File

@@ -714,6 +714,18 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
435,
/**/
434,
/**/
433,
/**/
432,
/**/
431,
/**/
430,
/**/
429,
/**/