diff options
author | Jouke Witteveen <j.witteveen@gmail.com> | 2022-01-17 19:11:59 -0500 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2022-01-17 19:11:59 -0500 |
commit | 2b25eac58717cb924d37bf6e13cf9bd389f9217c (patch) | |
tree | 365943dc26636229999bffdf234cf22cbe0d07ec /src/function.c | |
parent | e72c5e021ff3e9dec34c078a1a76a260fc562b90 (diff) | |
download | make-git-2b25eac58717cb924d37bf6e13cf9bd389f9217c.tar.gz |
* src/function.c (parse_textint): Handle ints without 0 properly.
* tests/scripts/functions/intcmp: Add tests for values without 0.
Diffstat (limited to 'src/function.c')
-rw-r--r-- | src/function.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/function.c b/src/function.c index 1120ad21..c27f573b 100644 --- a/src/function.c +++ b/src/function.c @@ -1294,7 +1294,7 @@ parse_textint (const char *number, const char *msg, const char *after_sign, *after_number; const char *p = next_token (number); int negative = *p == '-'; - int nonzero = 0; + int nonzero; if (*p == '\0') OS (fatal, *expanding_var, _("%s: empty value"), msg); @@ -1307,9 +1307,9 @@ parse_textint (const char *number, const char *msg, *numstart = p; while (ISDIGIT (*p)) - if (*p++ == '0') - nonzero = 1; + ++p; after_number = p; + nonzero = *numstart != after_number; *sign = negative ? -nonzero : nonzero; /* Check for extra non-whitespace stuff after the value. */ |