diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-12-15 16:41:07 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-12-15 16:41:07 +0000 |
commit | 8f93e232b461adb585ff7cc96c46a018afdcb378 (patch) | |
tree | cdb4968c74c9185d7c786c319c0d9a339ffd399a /set_str_raw.c | |
parent | ae84a54357ab7e180ba80b4cb90885f052ca335d (diff) | |
download | mpfr-8f93e232b461adb585ff7cc96c46a018afdcb378.tar.gz |
added error message when memory allocation fails
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@879 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'set_str_raw.c')
-rw-r--r-- | set_str_raw.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/set_str_raw.c b/set_str_raw.c index 818f954b4..f736fc01b 100644 --- a/set_str_raw.c +++ b/set_str_raw.c @@ -48,10 +48,14 @@ mpfr_set_str_raw(x, str) unsigned long j, l, k = 0, xsize, cnt, alloc; mp_limb_t *xp; long expn = 0, e; char *endstr2; - xp = MPFR_MANT (x); + xp = MPFR_MANT(x); xsize = 1 + (MPFR_PREC(x)-1)/BITS_PER_MP_LIMB; alloc = (strlen(str)+1) * sizeof(char); str0 = str2 = (char *) (*_mp_allocate_func) (alloc); + if (str0 == NULL) { + fprintf (stderr, "Error in mpfr_set_str_raw: no more memory available\n"); + exit (1); + } if (*str == '-') { negative = 1; str++; } else if (*str == '+') str++; |