Mercurial > vim
diff src/float.c @ 30053:f5cbf8a4043d v9.0.0364
patch 9.0.0364: clang static analyzer gives warnings
Commit: https://github.com/vim/vim/commit/c99e182e1fb54e39540d25d0ccd8dcdde25bb96c
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sat Sep 3 10:52:24 2022 +0100
patch 9.0.0364: clang static analyzer gives warnings
Problem: Clang static analyzer gives warnings.
Solution: Avoid the warnings. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/11043)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 03 Sep 2022 12:00:05 +0200 |
parents | 85866e069c24 |
children | 029c59bf78f1 |
line wrap: on
line diff
--- a/src/float.c +++ b/src/float.c @@ -54,12 +54,11 @@ string2float( if (skip_quotes && vim_strchr((char_u *)s, '\'') != NULL) { char_u buf[100]; - char_u *p = buf; + char_u *p; int quotes = 0; vim_strncpy(buf, (char_u *)s, 99); - p = buf; - for (;;) + for (p = buf; ; p = skipdigits(p)) { // remove single quotes between digits, not in the exponent if (*p == '\'') @@ -69,7 +68,6 @@ string2float( } if (!vim_isdigit(*p)) break; - p = skipdigits(p); } s = (char *)buf; f = strtod(s, &s);