0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 7.4.1216

Problem:    Still using HAVE_STDARG_H.
Solution:   Assume it's always defined.
This commit is contained in:
Bram Moolenaar
2016-01-30 21:48:49 +01:00
parent b638a7be95
commit ba4ef2757c
10 changed files with 22 additions and 44 deletions

View File

@@ -15217,13 +15217,11 @@ f_prevnonblank(typval_T *argvars, typval_T *rettv)
rettv->vval.v_number = lnum;
}
#ifdef HAVE_STDARG_H
/* This dummy va_list is here because:
* - passing a NULL pointer doesn't work when va_list isn't a pointer
* - locally in the function results in a "used before set" warning
* - using va_start() to initialize it gives "function with fixed args" error */
static va_list ap;
#endif
/*
* "printf()" function
@@ -15231,32 +15229,29 @@ static va_list ap;
static void
f_printf(typval_T *argvars, typval_T *rettv)
{
char_u buf[NUMBUFLEN];
int len;
char_u *s;
int saved_did_emsg = did_emsg;
char *fmt;
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
#ifdef HAVE_STDARG_H /* only very old compilers can't do this */
{
char_u buf[NUMBUFLEN];
int len;
char_u *s;
int saved_did_emsg = did_emsg;
char *fmt;
/* Get the required length, allocate the buffer and do it for real. */
did_emsg = FALSE;
fmt = (char *)get_tv_string_buf(&argvars[0], buf);
len = vim_vsnprintf(NULL, 0, fmt, ap, argvars + 1);
if (!did_emsg)
/* Get the required length, allocate the buffer and do it for real. */
did_emsg = FALSE;
fmt = (char *)get_tv_string_buf(&argvars[0], buf);
len = vim_vsnprintf(NULL, 0, fmt, ap, argvars + 1);
if (!did_emsg)
{
s = alloc(len + 1);
if (s != NULL)
{
s = alloc(len + 1);
if (s != NULL)
{
rettv->vval.v_string = s;
(void)vim_vsnprintf((char *)s, len + 1, fmt, ap, argvars + 1);
}
rettv->vval.v_string = s;
(void)vim_vsnprintf((char *)s, len + 1, fmt, ap, argvars + 1);
}
did_emsg |= saved_did_emsg;
}
#endif
did_emsg |= saved_did_emsg;
}
/*