To: vim_dev@googlegroups.com Subject: Patch 9.0.1633 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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 -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///