aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/strings.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-04-07 03:43:36 +0200
committerGitHub <noreply@github.com>2019-04-07 03:43:36 +0200
commit805b5f2e1ec074648e2142c1eaab1d2c089aa58d (patch)
tree64a3405bbc6c28580507d4de4a281932f719f7e5 /src/nvim/strings.c
parentcf072cf223287d37c1c59926ff4600d249e1522c (diff)
parent4d6e99c94913676cc7a6581c13579e5f9fbe26c5 (diff)
downloadrneovim-805b5f2e1ec074648e2142c1eaab1d2c089aa58d.tar.gz
rneovim-805b5f2e1ec074648e2142c1eaab1d2c089aa58d.tar.bz2
rneovim-805b5f2e1ec074648e2142c1eaab1d2c089aa58d.zip
Merge #9840 from janlazo/vim-8.0.0709
vim-patch:8.0.{709,728},8.1.{135,308}
Diffstat (limited to 'src/nvim/strings.c')
-rw-r--r--src/nvim/strings.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/nvim/strings.c b/src/nvim/strings.c
index 96a8dfd295..3ba9354c67 100644
--- a/src/nvim/strings.c
+++ b/src/nvim/strings.c
@@ -678,12 +678,12 @@ static float_T tv_float(typval_T *const tvs, int *const idxp)
// are discarded. If "str_m" is greater than zero it is guaranteed
// the resulting string will be NUL-terminated.
-// vim_vsnprintf() can be invoked with either "va_list" or a list of
+// vim_vsnprintf_typval() can be invoked with either "va_list" or a list of
// "typval_T". When the latter is not used it must be NULL.
/// Append a formatted value to the string
///
-/// @see vim_vsnprintf().
+/// @see vim_vsnprintf_typval().
int vim_snprintf_add(char *str, size_t str_m, char *fmt, ...)
FUNC_ATTR_PRINTF(3, 4)
{
@@ -697,7 +697,7 @@ int vim_snprintf_add(char *str, size_t str_m, char *fmt, ...)
}
va_list ap;
va_start(ap, fmt);
- const int str_l = vim_vsnprintf(str + len, space, fmt, ap, NULL);
+ const int str_l = vim_vsnprintf(str + len, space, fmt, ap);
va_end(ap);
return str_l;
}
@@ -715,7 +715,7 @@ int vim_snprintf(char *str, size_t str_m, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
- const int str_l = vim_vsnprintf(str, str_m, fmt, ap, NULL);
+ const int str_l = vim_vsnprintf(str, str_m, fmt, ap);
va_end(ap);
return str_l;
}
@@ -736,6 +736,10 @@ static const char *infinity_str(bool positive, char fmt_spec,
return table[idx];
}
+int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap)
+{
+ return vim_vsnprintf_typval(str, str_m, fmt, ap, NULL);
+}
/// Write formatted value to the string
///
@@ -748,8 +752,8 @@ static const char *infinity_str(bool positive, char fmt_spec,
///
/// @return Number of bytes excluding NUL byte that would be written to the
/// string if str_m was greater or equal to the return value.
-int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap,
- typval_T *const tvs)
+int vim_vsnprintf_typval(
+ char *str, size_t str_m, const char *fmt, va_list ap, typval_T *const tvs)
{
size_t str_l = 0;
bool str_avail = str_l < str_m;