summaryrefslogtreecommitdiff
path: root/mpz/iset_str.c
diff options
context:
space:
mode:
authorMarco Bodrato <bodrato@mail.dm.unipi.it>2016-11-09 23:07:54 +0100
committerMarco Bodrato <bodrato@mail.dm.unipi.it>2016-11-09 23:07:54 +0100
commit6a2dfd953cdb8d2065751538d72179c10c98c9e3 (patch)
treeb97f59df1fc8f285ed61cc4f40c1f90254129b57 /mpz/iset_str.c
parente6a4ed98704dea7a74d445fe256d34a91af97372 (diff)
downloadgmp-6a2dfd953cdb8d2065751538d72179c10c98c9e3.tar.gz
mpz/iset_str.c: Lazy allocation
Diffstat (limited to 'mpz/iset_str.c')
-rw-r--r--mpz/iset_str.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mpz/iset_str.c b/mpz/iset_str.c
index d0bf81132..2df12f9a0 100644
--- a/mpz/iset_str.c
+++ b/mpz/iset_str.c
@@ -36,8 +36,9 @@ see https://www.gnu.org/licenses/. */
int
mpz_init_set_str (mpz_ptr x, const char *str, int base)
{
- ALLOC (x) = 1;
- PTR (x) = __GMP_ALLOCATE_FUNC_LIMBS (1);
+ static const mp_limb_t dummy_limb=0xc1a0;
+ ALLOC (x) = 0;
+ PTR (x) = (mp_ptr) &dummy_limb;
/* if str has no digits mpz_set_str leaves x->_mp_size unset */
SIZ (x) = 0;