[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, feature/api-mpfr, updated. gawk-4.1.0-25
From: |
Andrew J. Schorr |
Subject: |
[gawk-diffs] [SCM] gawk branch, feature/api-mpfr, updated. gawk-4.1.0-2596-ge176d2c |
Date: |
Fri, 14 Apr 2017 10:28:09 -0400 (EDT) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, feature/api-mpfr has been updated
via e176d2c3808ae99e805c402ffaccf1fc937e318d (commit)
from 3978dea8ddf29e8185cf61d5fba897d58439cade (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=e176d2c3808ae99e805c402ffaccf1fc937e318d
commit e176d2c3808ae99e805c402ffaccf1fc937e318d
Author: Andrew J. Schorr <address@hidden>
Date: Fri Apr 14 10:27:24 2017 -0400
In the intdiv extension, division by zero now gives a warning and returns
-1 instead of throwing a fatal error.
diff --git a/extension/ChangeLog b/extension/ChangeLog
index d8eb618..ef66846 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-14 Andrew J. Schorr <address@hidden>
+
+ * intdiv.c (do_intdiv): On division by zero, return -1 and issue a
+ warning instead of throwing a fatal error.
+
2017-04-13 Andrew J. Schorr <address@hidden>
* intdiv.c (do_intdiv): On a division by zero fatal error, there's
diff --git a/extension/intdiv.c b/extension/intdiv.c
index e3dd0ee..aa1afd1 100644
--- a/extension/intdiv.c
+++ b/extension/intdiv.c
@@ -129,8 +129,10 @@ do_intdiv(int nargs, awk_value_t *result, struct
awk_ext_func *unused)
num = double_to_int(nv.num_value);
denom = double_to_int(dv.num_value);
- if (denom == 0.0)
- fatal(ext_id, _("intdiv: division by zero attempted"));
+ if (denom == 0.0) {
+ warning(ext_id, _("intdiv: division by zero
attempted"));
+ return make_number(-1, result);
+ }
quotient = double_to_int(num / denom);
#ifdef HAVE_FMOD
@@ -161,8 +163,14 @@ do_intdiv(int nargs, awk_value_t *result, struct
awk_ext_func *unused)
mpz_clear(numer);
return make_number(-1, result);
}
- if (mpz_sgn(denom) == 0)
- fatal(ext_id, _("intdiv: division by zero attempted"));
+ if (mpz_sgn(denom) == 0) {
+ warning(ext_id, _("intdiv: division by zero
attempted"));
+ if (numer == numer_tmp)
+ mpz_clear(numer);
+ if (denom == denom_tmp)
+ mpz_clear(denom);
+ return make_number(-1, result);
+ }
/* ask gawk to allocate return values for us */
quotient = get_mpz_ptr();
-----------------------------------------------------------------------
Summary of changes:
extension/ChangeLog | 5 +++++
extension/intdiv.c | 16 ++++++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, feature/api-mpfr, updated. gawk-4.1.0-2596-ge176d2c,
Andrew J. Schorr <=