gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, master, updated. c9e416d0703fc11828a1d17


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. c9e416d0703fc11828a1d175002805b326029735
Date: Wed, 14 Nov 2012 19:38:18 +0000

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, master has been updated
       via  c9e416d0703fc11828a1d175002805b326029735 (commit)
      from  ad772284fd932cc884431e71487917ba42aa2b30 (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=c9e416d0703fc11828a1d175002805b326029735

commit c9e416d0703fc11828a1d175002805b326029735
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Nov 14 21:37:47 2012 +0200

    Minor cleanup in calls to mpfr routines.

diff --git a/ChangeLog b/ChangeLog
index 829907e..c489049 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,13 @@
        * io.c (do_find_source): On VMS, don't add the `/' separater.
        Thanks to Anders Wallin.
 
+       MPFR minor cleanup:
+
+       * awk.h (mpfr_unset): Declare new function.
+       * mpfr.c (mpfr_unset): New function.
+       * node.c (r_unref): Call it instead of inline code.
+       * gawk_api.c (api_sym_update_scalar): Call it instead of inline code.
+
 2012-11-13         Arnold D. Robbins     <address@hidden>
 
        * symbol.c (get_symbols): Check type, not vname. Keeps
diff --git a/awk.h b/awk.h
index 2aa944c..c3f0d8c 100644
--- a/awk.h
+++ b/awk.h
@@ -1575,6 +1575,7 @@ extern long getenv_long(const char *name);
 /* mpfr.c */
 extern void set_PREC(void);
 extern void set_ROUNDMODE(void);
+extern void mpfr_unset(NODE *n);
 #ifdef HAVE_MPFR
 extern int mpg_cmp(const NODE *, const NODE *);
 extern int format_ieee(mpfr_ptr, int);
diff --git a/gawkapi.c b/gawkapi.c
index c9b2ace..ba3fc50 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -681,12 +681,8 @@ api_sym_update_scalar(awk_ext_id_t id,
                        /* r_unref: */
                        if ((r->flags & (MALLOC|STRCUR)) == (MALLOC|STRCUR))
                                efree(r->stptr);
-#ifdef HAVE_MPFR
-                       if (is_mpg_float(r))
-                               mpfr_clear(r->mpg_numbr);
-                       else if (is_mpg_integer(r))
-                               mpz_clear(r->mpg_i);
-#endif
+
+                       mpfr_unset(r);
                        free_wstr(r);
 
                        /* make_str_node(s, l, ALREADY_MALLOCED): */
diff --git a/mpfr.c b/mpfr.c
index 434cd2b..a147150 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -1603,6 +1603,17 @@ mpg_fmt(const char *mesg, ...)
        return mesg;
 }
 
+/* mpfr_unset --- clear out the MPFR values */
+
+void
+mpfr_unset(NODE *n)
+{
+       if (is_mpg_float(n))
+               mpfr_clear(n->mpg_numbr);
+       else if (is_mpg_integer(n))
+               mpz_clear(n->mpg_i);
+}
+
 #else
 
 void
@@ -1617,4 +1628,9 @@ set_ROUNDMODE()
        /* dummy function */
 }
 
+void
+mpfr_unset(NODE *n)
+{
+       /* dummy function */
+}
 #endif
diff --git a/node.c b/node.c
index f8152ba..a857aa1 100644
--- a/node.c
+++ b/node.c
@@ -471,12 +471,7 @@ r_unref(NODE *tmp)
                efree(tmp->stptr);
 #endif
 
-#ifdef HAVE_MPFR
-       if (is_mpg_float(tmp))
-               mpfr_clear(tmp->mpg_numbr);
-       else if (is_mpg_integer(tmp))
-               mpz_clear(tmp->mpg_i);
-#endif
+       mpfr_unset(tmp);
 
        free_wstr(tmp);
        freenode(tmp);

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog |    7 +++++++
 awk.h     |    1 +
 gawkapi.c |    8 ++------
 mpfr.c    |   16 ++++++++++++++++
 node.c    |    7 +------
 5 files changed, 27 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]