diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-06-15 10:56:41 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-06-15 10:56:41 +0100 |
commit | 19dfa276c37dcf657922c6f9b48cf2954191e8b6 (patch) | |
tree | efa66453203e8ef4c31302fa59f18cad14714b62 /src/eval.c | |
parent | 166cd7b801ebe4aa042a9bbd6007d1951800aaa9 (diff) |
patch 9.0.1633: duplicate code for converting float to stringv9.0.1633
Problem: Duplicate code for converting float to string.
Solution: Use tv_get_string(). (closes #12521)
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/eval.c b/src/eval.c index 89141bfe3e..8660a25d50 100644 --- a/src/eval.c +++ b/src/eval.c @@ -570,8 +570,7 @@ skip_expr_concatenate( /* * Convert "tv" to a string. - * When "convert" is TRUE convert a List into a sequence of lines and convert - * a Float to a String. + * When "convert" is TRUE convert a List into a sequence of lines. * Returns an allocated string (NULL when out of memory). */ char_u * @@ -579,7 +578,6 @@ typval2string(typval_T *tv, int convert) { garray_T ga; char_u *retval; - char_u numbuf[NUMBUFLEN]; if (convert && tv->v_type == VAR_LIST) { @@ -593,11 +591,6 @@ typval2string(typval_T *tv, int convert) ga_append(&ga, NUL); retval = (char_u *)ga.ga_data; } - else if (convert && tv->v_type == VAR_FLOAT) - { - vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv->vval.v_float); - retval = vim_strsave(numbuf); - } else retval = vim_strsave(tv_get_string(tv)); return retval; @@ -606,8 +599,7 @@ typval2string(typval_T *tv, int convert) /* * Top level evaluation function, returning a string. Does not handle line * breaks. - * When "convert" is TRUE convert a List into a sequence of lines and convert - * a Float to a String. + * When "convert" is TRUE convert a List into a sequence of lines. * Return pointer to allocated memory, or NULL for failure. */ char_u * |