Mercurial > vim
changeset 9391:4c40631238e4 v7.4.1977
commit https://github.com/vim/vim/commit/bde9810d6103ffe3a22a9330021cb21db1ed1792
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jul 1 20:03:42 2016 +0200
patch 7.4.1977
Problem: With 64 bit changes don't need three calls to sprintf().
Solution: Simplify the code, use vim_snprintf(). (Ken Takata)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 01 Jul 2016 20:15:05 +0200 |
parents | 18d12e179a7e |
children | 6629bab9f8f6 |
files | src/fileio.c src/version.c |
diffstat | 2 files changed, 6 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/fileio.c +++ b/src/fileio.c @@ -5231,17 +5231,8 @@ msg_add_lines( if (insert_space) *p++ = ' '; if (shortmess(SHM_LINES)) -#ifdef LONG_LONG_OFF_T - sprintf((char *)p, - "%ldL, %lldC", lnum, (long long)nchars); -#elif defined(WIN3264) - sprintf((char *)p, - "%ldL, %I64dC", lnum, (__int64)nchars); -#else - sprintf((char *)p, - /* Explicit typecast avoids warning on Mac OS X 10.6 */ - "%ldL, %ldC", lnum, (long)nchars); -#endif + vim_snprintf((char *)p, IOSIZE - (p - IObuff), + "%ldL, %lldC", lnum, (varnumber_T)nchars); else { if (lnum == 1) @@ -5252,17 +5243,8 @@ msg_add_lines( if (nchars == 1) STRCPY(p, _("1 character")); else -#ifdef LONG_LONG_OFF_T - sprintf((char *)p, - _("%lld characters"), (long long)nchars); -#elif defined(WIN3264) - sprintf((char *)p, - _("%I64d characters"), (__int64)nchars); -#else - sprintf((char *)p, - /* Explicit typecast avoids warning on Mac OS X 10.6 */ - _("%ld characters"), (long)nchars); -#endif + vim_snprintf((char *)p, IOSIZE - (p - IObuff), + _("%lld characters"), (varnumber_T)nchars); } }