summaryrefslogtreecommitdiff
path: root/mpz/set_str.c
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2001-05-03 00:21:43 +0200
committerKevin Ryde <user42@zip.com.au>2001-05-03 00:21:43 +0200
commitde4f83ea60bbe15e09f59c0530dda5090609a72a (patch)
treeca5d71e66288a15440716786363a4d94e4539a31 /mpz/set_str.c
parent3e04b26002ae0fbeb52e7e1b4d9fff2094f9a725 (diff)
downloadgmp-de4f83ea60bbe15e09f59c0530dda5090609a72a.tar.gz
* mpz/set_str.c: Fix for trailing white space on zero, eg. "0 ".
This is only a problem with zero, shows up as setting the mpz to "48" because mpn_set_str doesn't like str_len==0.
Diffstat (limited to 'mpz/set_str.c')
-rw-r--r--mpz/set_str.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mpz/set_str.c b/mpz/set_str.c
index 34595d6e7..55d03ba23 100644
--- a/mpz/set_str.c
+++ b/mpz/set_str.c
@@ -97,8 +97,8 @@ mpz_set_str (mpz_ptr x, const char *str, int base)
}
}
- /* Skip leading zeros. */
- while (c == '0')
+ /* Skip leading zeros and white space. */
+ while (c == '0' || isspace (c))
c = *str++;
/* Make sure the string does not become empty, mpn_set_str would fail. */
if (c == 0)