Patch 9.0.1633
Problem: Duplicate code for converting float to string.
Solution: Use tv_get_string(). (closes #12521)
Files: src/eval.c
*** ../vim-9.0.1632/src/eval.c 2023-06-01 19:26:23.435627545 +0100
--- src/eval.c 2023-06-15 10:35:46.813581256 +0100
***************
*** 570,577 ****
/*
* Convert "tv" to a string.
! * When "convert" is TRUE convert a List into a sequence of lines and convert
! * a Float to a String.
* Returns an allocated string (NULL when out of memory).
*/
char_u *
--- 570,576 ----
/*
* Convert "tv" 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,585 ****
{
garray_T ga;
char_u *retval;
- char_u numbuf[NUMBUFLEN];
if (convert && tv->v_type == VAR_LIST)
{
--- 578,583 ----
***************
*** 593,603 ****
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;
--- 591,596 ----
***************
*** 606,613 ****
/*
* 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.
* Return pointer to allocated memory, or NULL for failure.
*/
char_u *
--- 599,605 ----
/*
* Top level evaluation function, returning a string. Does not handle line
* breaks.
! * When "convert" is TRUE convert a List into a sequence of lines.
* Return pointer to allocated memory, or NULL for failure.
*/
char_u *
*** ../vim-9.0.1632/src/version.c 2023-06-14 19:45:39.538903631 +0100
--- src/version.c 2023-06-15 10:37:47.333841087 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1633,
/**/
--
hundred-and-one symptoms of being an internet addict:
175. You send yourself e-mail before you go to bed to remind you
what to do when you wake up.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20230615094250.202B51C0D56%40moolenaar.net.