Skip to content

Commit 963c6fe

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 373d4dd + 8327d1d commit 963c6fe

37 files changed

+406
-397
lines changed

src/Makefile

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2109,25 +2109,23 @@ test1 \
21092109
test_autoformat_join \
21102110
test_changelist \
21112111
test_close_count \
2112-
test_comparators \
21132112
test_erasebackword \
21142113
test_eval \
21152114
test_fixeol \
2116-
test_getcwd \
21172115
test_insertcount \
21182116
test_listchars \
21192117
test_search_mbyte \
21202118
test_wordcount \
21212119
test3 test4 test5 test6 test7 test8 test9 \
21222120
test11 test12 test14 test15 test17 test18 test19 \
2123-
test20 test21 test22 test23 test24 test25 test26 test27 test28 test29 \
2121+
test20 test21 test22 test25 test27 test28 test29 \
21242122
test30 test31 test32 test33 test34 test36 test37 test38 test39 \
21252123
test40 test41 test42 test43 test44 test45 test48 test49 \
21262124
test50 test51 test52 test53 test54 test55 test56 test57 test59 \
2127-
test60 test64 test66 test67 test68 test69 \
2128-
test70 test72 test73 test74 test75 test77 test78 test79 \
2125+
test60 test64 test66 test68 test69 \
2126+
test70 test72 test73 test74 test77 test78 test79 \
21292127
test80 test83 test84 test85 test86 test87 test88 \
2130-
test91 test94 test95 test97 test98 test99 \
2128+
test91 test94 test95 test98 test99 \
21312129
test100 test101 test103 test104 test107 test108:
21322130
cd testdir; rm -f [email protected]; $(MAKE) -f Makefile [email protected] VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE)
21332131

@@ -2151,6 +2149,7 @@ test_arglist \
21512149
test_clientserver \
21522150
test_cmdline \
21532151
test_command_count \
2152+
test_comparators \
21542153
test_crypt \
21552154
test_cscope \
21562155
test_cursor_func \
@@ -2159,9 +2158,12 @@ test_arglist \
21592158
test_digraph \
21602159
test_display \
21612160
test_edit \
2161+
test_escaped_glob \
21622162
test_ex_undo \
21632163
test_ex_z \
2164+
test_exec_while_if \
21642165
test_execute_func \
2166+
test_exists_autocmd \
21652167
test_expand \
21662168
test_expand_dllpath \
21672169
test_expr \
@@ -2180,6 +2182,7 @@ test_arglist \
21802182
test_fold \
21812183
test_functions \
21822184
test_ga \
2185+
test_getcwd \
21832186
test_gf \
21842187
test_glob2regpat \
21852188
test_global \
@@ -2208,6 +2211,7 @@ test_arglist \
22082211
test_lua \
22092212
test_makeencoding \
22102213
test_man \
2214+
test_maparg \
22112215
test_mapping \
22122216
test_marks \
22132217
test_match \
@@ -2226,6 +2230,7 @@ test_arglist \
22262230
test_partial \
22272231
test_paste \
22282232
test_perl \
2233+
test_plus_arg_edit \
22292234
test_popup \
22302235
test_profile \
22312236
test_put \
@@ -2236,6 +2241,7 @@ test_arglist \
22362241
test_quickfix \
22372242
test_quotestar \
22382243
test_recover \
2244+
test_regex_char_classes \
22392245
test_regexp_latin \
22402246
test_regexp_utf8 \
22412247
test_reltime \
@@ -3304,7 +3310,7 @@ objects/channel.o: channel.c
33043310
Makefile:
33053311
@echo The name of the makefile MUST be "Makefile" (with capital M)!!!!
33063312

3307-
CCCTERM = $(CCC) -Ilibvterm/include -DINLINE=""
3313+
CCCTERM = $(CCC) -Ilibvterm/include -DINLINE="" -DVSNPRINTF=vim_vsnprintf
33083314
objects/term_encoding.o: libvterm/src/encoding.c $(TERM_DEPS)
33093315
$(CCCTERM) -o $@ libvterm/src/encoding.c
33103316

src/evalfunc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8062,14 +8062,15 @@ f_printf(typval_T *argvars, typval_T *rettv)
80628062
/* Get the required length, allocate the buffer and do it for real. */
80638063
did_emsg = FALSE;
80648064
fmt = (char *)get_tv_string_buf(&argvars[0], buf);
8065-
len = vim_vsnprintf(NULL, 0, fmt, ap, argvars + 1);
8065+
len = vim_vsnprintf_typval(NULL, 0, fmt, ap, argvars + 1);
80668066
if (!did_emsg)
80678067
{
80688068
s = alloc(len + 1);
80698069
if (s != NULL)
80708070
{
80718071
rettv->vval.v_string = s;
8072-
(void)vim_vsnprintf((char *)s, len + 1, fmt, ap, argvars + 1);
8072+
(void)vim_vsnprintf_typval((char *)s, len + 1, fmt,
8073+
ap, argvars + 1);
80738074
}
80748075
}
80758076
did_emsg |= saved_did_emsg;

src/ex_cmds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3968,8 +3968,8 @@ do_ecmd(
39683968
* <VN> We could instead free the synblock
39693969
* and re-attach to buffer, perhaps.
39703970
*/
3971-
if (curwin->w_buffer != NULL
3972-
&& curwin->w_s == &(curwin->w_buffer->b_s))
3971+
if (curwin->w_buffer == NULL
3972+
|| curwin->w_s == &(curwin->w_buffer->b_s))
39733973
curwin->w_s = &(buf->b_s);
39743974
#endif
39753975
curwin->w_buffer = buf;

src/ex_getln.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7056,7 +7056,13 @@ open_cmdwin(void)
70567056
else
70577057
ccline.cmdbuff = vim_strsave(ml_get_curline());
70587058
if (ccline.cmdbuff == NULL)
7059+
{
7060+
ccline.cmdbuff = vim_strsave((char_u *)"");
7061+
ccline.cmdlen = 0;
7062+
ccline.cmdbufflen = 1;
7063+
ccline.cmdpos = 0;
70597064
cmdwin_result = Ctrl_C;
7065+
}
70607066
else
70617067
{
70627068
ccline.cmdlen = (int)STRLEN(ccline.cmdbuff);

src/libvterm/src/vterm.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,42 @@ static int outbuffer_is_full(VTerm *vt)
130130
return vt->outbuffer_cur >= vt->outbuffer_len - 1;
131131
}
132132

133+
#if _XOPEN_SOURCE >= 500 || _ISOC99_SOURCE || _BSD_SOURCE
134+
# undef VSNPRINTF
135+
# define VSNPRINTF vsnprintf
136+
#else
137+
# ifdef VSNPRINTF
138+
/* Use a provided vsnprintf() function. */
139+
int VSNPRINTF(char *str, size_t str_m, const char *fmt, va_list ap);
140+
# endif
141+
#endif
142+
143+
133144
INTERNAL void vterm_push_output_vsprintf(VTerm *vt, const char *format, va_list args)
134145
{
135146
int written;
147+
#ifndef VSNPRINTF
148+
/* When vsnprintf() is not available (C90) fall back to vsprintf(). */
136149
char buffer[1024]; /* 1Kbyte is enough for everybody, right? */
150+
#endif
137151

138152
if(outbuffer_is_full(vt)) {
139153
DEBUG_LOG("vterm_push_output(): buffer overflow; truncating output\n");
140154
return;
141155
}
142156

157+
#ifdef VSNPRINTF
158+
written = VSNPRINTF(vt->outbuffer + vt->outbuffer_cur,
159+
vt->outbuffer_len - vt->outbuffer_cur,
160+
format, args);
161+
162+
if(written == (int)(vt->outbuffer_len - vt->outbuffer_cur)) {
163+
/* output was truncated */
164+
vt->outbuffer_cur = vt->outbuffer_len - 1;
165+
}
166+
else
167+
vt->outbuffer_cur += written;
168+
#else
143169
written = vsprintf(buffer, format, args);
144170

145171
if(written >= (int)(vt->outbuffer_len - vt->outbuffer_cur)) {
@@ -151,6 +177,7 @@ INTERNAL void vterm_push_output_vsprintf(VTerm *vt, const char *format, va_list
151177
strncpy(vt->outbuffer + vt->outbuffer_cur, buffer, written + 1);
152178
vt->outbuffer_cur += written;
153179
}
180+
#endif
154181
}
155182

156183
INTERNAL void vterm_push_output_sprintf(VTerm *vt, const char *format, ...)

src/message.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ smsg(char_u *s, ...)
382382
va_list arglist;
383383

384384
va_start(arglist, s);
385-
vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist, NULL);
385+
vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist);
386386
va_end(arglist);
387387
return msg(IObuff);
388388
}
@@ -396,7 +396,7 @@ smsg_attr(int attr, char_u *s, ...)
396396
va_list arglist;
397397

398398
va_start(arglist, s);
399-
vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist, NULL);
399+
vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist);
400400
va_end(arglist);
401401
return msg_attr(IObuff, attr);
402402
}
@@ -4236,7 +4236,7 @@ infinity_str(int positive,
42364236
/*
42374237
* When va_list is not supported we only define vim_snprintf().
42384238
*
4239-
* vim_vsnprintf() can be invoked with either "va_list" or a list of
4239+
* vim_vsnprintf_typval() can be invoked with either "va_list" or a list of
42404240
* "typval_T". When the latter is not used it must be NULL.
42414241
*/
42424242

@@ -4258,7 +4258,7 @@ vim_snprintf_add(char *str, size_t str_m, char *fmt, ...)
42584258
else
42594259
space = str_m - len;
42604260
va_start(ap, fmt);
4261-
str_l = vim_vsnprintf(str + len, space, fmt, ap, NULL);
4261+
str_l = vim_vsnprintf(str + len, space, fmt, ap);
42624262
va_end(ap);
42634263
return str_l;
42644264
}
@@ -4270,13 +4270,23 @@ vim_snprintf(char *str, size_t str_m, char *fmt, ...)
42704270
int str_l;
42714271

42724272
va_start(ap, fmt);
4273-
str_l = vim_vsnprintf(str, str_m, fmt, ap, NULL);
4273+
str_l = vim_vsnprintf(str, str_m, fmt, ap);
42744274
va_end(ap);
42754275
return str_l;
42764276
}
42774277

42784278
int
42794279
vim_vsnprintf(
4280+
char *str,
4281+
size_t str_m,
4282+
char *fmt,
4283+
va_list ap)
4284+
{
4285+
return vim_vsnprintf_typval(str, str_m, fmt, ap, NULL);
4286+
}
4287+
4288+
int
4289+
vim_vsnprintf_typval(
42804290
char *str,
42814291
size_t str_m,
42824292
char *fmt,

src/netbeans.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2301,7 +2301,7 @@ coloncmd(char *cmd, ...)
23012301
va_list ap;
23022302

23032303
va_start(ap, cmd);
2304-
vim_vsnprintf(buf, sizeof(buf), cmd, ap, NULL);
2304+
vim_vsnprintf(buf, sizeof(buf), cmd, ap);
23052305
va_end(ap);
23062306

23072307
nbdebug((" COLONCMD %s\n", buf));

src/proto.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ _RTLENTRYF
127127
# endif
128128
vim_snprintf(char *, size_t, char *, ...);
129129

130-
int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs);
130+
int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap);
131+
int vim_vsnprintf_typval(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs);
131132

132133
# include "message.pro"
133134
# include "misc1.pro"

src/testdir/Make_all.mak

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ SCRIPTS_ALL = \
2424
test19.out \
2525
test20.out \
2626
test22.out \
27-
test23.out \
28-
test24.out \
29-
test26.out \
3027
test28.out \
3128
test29.out \
3229
test31.out \
@@ -51,12 +48,10 @@ SCRIPTS_ALL = \
5148
test60.out \
5249
test64.out \
5350
test66.out \
54-
test67.out \
5551
test68.out \
5652
test69.out \
5753
test70.out \
5854
test73.out \
59-
test75.out \
6055
test77.out \
6156
test79.out \
6257
test80.out \
@@ -75,11 +70,9 @@ SCRIPTS_ALL = \
7570
test_autoformat_join.out \
7671
test_changelist.out \
7772
test_close_count.out \
78-
test_comparators.out \
7973
test_erasebackword.out \
8074
test_eval.out \
8175
test_fixeol.out \
82-
test_getcwd.out \
8376
test_insertcount.out \
8477
test_listchars.out \
8578
test_search_mbyte.out \
@@ -99,8 +92,7 @@ SCRIPTS_MORE1 = \
9992
SCRIPTS_MORE2 = \
10093
test12.out \
10194
test25.out \
102-
test49.out \
103-
test97.out
95+
test49.out
10496

10597

10698
# Tests that run on most systems, but not MingW and Cygwin.

src/testdir/Make_ming.mak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fixff:
6969
-$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=dos|upd" +q *.in *.ok
7070
-$(VIMPROG) -u dos.vim $(NO_INITS) "+argdo set ff=unix|upd" +q \
7171
dotest.in test60.ok test_listchars.ok \
72-
test_getcwd.ok test_wordcount.ok
72+
test_wordcount.ok
7373

7474
clean:
7575
-@if exist *.out $(DEL) *.out

0 commit comments

Comments
 (0)