aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--awk.h1
-rw-r--r--dfa.c16
-rw-r--r--main.c5
-rw-r--r--mpfr.c9
5 files changed, 35 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 6acff889..ced3cdca 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2014-07-31 Arnold D. Robbins <arnold@skeeve.com>
+
+ * dfa.c: Sync with GNU grep. Mainly white space differences.
+
+ Unrelated:
+
+ * mpfr.c (cleanup_mpfr): New function to deallocate _mpf_t1
+ and _mpf_t2; removes some valgrind warnings.
+ * awk.h (cleanup_mpfr): Add declaration.
+ * main.c (main): Add call to `cleanup_mpfr'.
+
2014-07-25 Arnold D. Robbins <arnold@skeeve.com>
* main.c (main): Add a warning message if -M is used and gawk was
diff --git a/awk.h b/awk.h
index dd5bbe04..c964ad19 100644
--- a/awk.h
+++ b/awk.h
@@ -1570,6 +1570,7 @@ extern NODE *do_mpfr_srand(int);
extern NODE *do_mpfr_strtonum(int);
extern NODE *do_mpfr_xor(int);
extern void init_mpfr(mpfr_prec_t, const char *);
+extern void cleanup_mpfr(void);
extern NODE *mpg_node(unsigned int);
extern const char *mpg_fmt(const char *, ...);
extern int mpg_strtoui(mpz_ptr, char *, size_t, char **, int);
diff --git a/dfa.c b/dfa.c
index e2a83d43..1a153785 100644
--- a/dfa.c
+++ b/dfa.c
@@ -1204,7 +1204,8 @@ parse_bracket_exp (void)
if (wc != WEOF && wc2 != WEOF)
{
work_mbc->ranges
- = maybe_realloc (work_mbc->ranges, work_mbc->nranges + 2,
+ = maybe_realloc (work_mbc->ranges,
+ work_mbc->nranges + 2,
&ranges_al, sizeof *work_mbc->ranges);
work_mbc->ranges[work_mbc->nranges].beg
= case_fold ? towlower (wc) : wc;
@@ -1213,7 +1214,8 @@ parse_bracket_exp (void)
if (case_fold && (iswalpha (wc) || iswalpha (wc2)))
{
- work_mbc->ranges[work_mbc->nranges].beg = towupper (wc);
+ work_mbc->ranges[work_mbc->nranges].beg
+ = towupper (wc);
work_mbc->ranges[work_mbc->nranges++].end
= towupper (wc2);
}
@@ -3783,13 +3785,13 @@ dfafree (struct dfa *d)
CAT (p->is==ZERO)? (q->is==ZERO)? (p->is!=ZERO && p->in plus
p->left : q->right : q->is!=ZERO) ? q->in plus
- p->is##q->left p->right##q->is p->is##q->is : p->right##q->left
+ p->is##q->left p->right##q->is p->is##q->is : p->right##q->left
ZERO
- OR longest common longest common (do p->is and substrings common to
- leading trailing q->is have same p->in and q->in
- (sub)sequence (sub)sequence length and
- of p->left of p->right content) ?
+ OR longest common longest common (do p->is and substrings common
+ leading trailing to q->is have same p->in and
+ (sub)sequence (sub)sequence q->in length and content) ?
+ of p->left of p->right
and q->left and q->right p->is : NULL
If there's anything else we recognize in the tree, all four sequences get set
diff --git a/main.c b/main.c
index d8acedaa..7f1595b8 100644
--- a/main.c
+++ b/main.c
@@ -754,6 +754,11 @@ out:
if (do_dump_vars)
dump_vars(varfile);
+#ifdef HAVE_MPFR
+ if (do_mpfr)
+ cleanup_mpfr();
+#endif
+
if (do_tidy_mem)
release_all_vars();
diff --git a/mpfr.c b/mpfr.c
index e9c9d154..3c7cb5d8 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -89,6 +89,15 @@ init_mpfr(mpfr_prec_t prec, const char *rmode)
register_exec_hook(mpg_interpret, 0);
}
+/* cleanup_mpfr --- clean stuff up, mainly for valgrind */
+
+void
+cleanup_mpfr(void)
+{
+ mpfr_clear(_mpf_t1);
+ mpfr_clear(_mpf_t2);
+}
+
/* mpg_node --- allocate a node to store MPFR float or GMP integer */
NODE *