comparison 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
comparison
equal deleted inserted replaced
30052:9577d585ab58 30053:f5cbf8a4043d
52 return 3; 52 return 3;
53 } 53 }
54 if (skip_quotes && vim_strchr((char_u *)s, '\'') != NULL) 54 if (skip_quotes && vim_strchr((char_u *)s, '\'') != NULL)
55 { 55 {
56 char_u buf[100]; 56 char_u buf[100];
57 char_u *p = buf; 57 char_u *p;
58 int quotes = 0; 58 int quotes = 0;
59 59
60 vim_strncpy(buf, (char_u *)s, 99); 60 vim_strncpy(buf, (char_u *)s, 99);
61 p = buf; 61 for (p = buf; ; p = skipdigits(p))
62 for (;;)
63 { 62 {
64 // remove single quotes between digits, not in the exponent 63 // remove single quotes between digits, not in the exponent
65 if (*p == '\'') 64 if (*p == '\'')
66 { 65 {
67 ++quotes; 66 ++quotes;
68 mch_memmove(p, p + 1, STRLEN(p)); 67 mch_memmove(p, p + 1, STRLEN(p));
69 } 68 }
70 if (!vim_isdigit(*p)) 69 if (!vim_isdigit(*p))
71 break; 70 break;
72 p = skipdigits(p);
73 } 71 }
74 s = (char *)buf; 72 s = (char *)buf;
75 f = strtod(s, &s); 73 f = strtod(s, &s);
76 *value = f; 74 *value = f;
77 return (int)((char_u *)s - buf) + quotes; 75 return (int)((char_u *)s - buf) + quotes;