diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2004-11-02 14:03:33 +0000 |
---|---|---|
committer | Paolo Bonzini <bonzini@gnu.org> | 2008-01-09 16:10:41 +0100 |
commit | 42e453acf46ca6f3319f1a90f21a27f11f4c07e6 (patch) | |
tree | e051323b40994bb6d413e4c278c27bd4ddc08653 /lib | |
parent | 87c703bf6390d996e280d6254dc30efe2e4ac05a (diff) | |
download | sed-42e453acf46ca6f3319f1a90f21a27f11f4c07e6.tar.gz |
cleanup match_ctx_clean
2004-10-27 Paolo Bonzini <bonzini@gnu.org>
* posix/regexec.c (match_ctx_free_subtops): Remove, merge into...
(match_ctx_clean): ... this function.
(match_ctx_free): Call match_ctx_clean.
diff -ru lib_mio/regexec.c lib/regexec.c
--- lib_mio/regexec.c 2004-10-27 13:03:14.000000000 +0200
+++ lib/regexec.c 2004-10-27 12:56:46.000000000 +0200
@@ -22,8 +22,6 @@
int n) internal_function;
static void match_ctx_clean (re_match_context_t *mctx) internal_function;
static void match_ctx_free (re_match_context_t *cache) internal_function;
-static void match_ctx_free_subtops (re_match_context_t *mctx)
- internal_function;
static reg_errcode_t match_ctx_add_entry (re_match_context_t *cache, int node,
int str_idx, int from, int to)
internal_function;
@@ -4103,28 +4101,6 @@
match_ctx_clean (mctx)
re_match_context_t *mctx;
{
- match_ctx_free_subtops (mctx);
- mctx->nsub_tops = 0;
- mctx->nbkref_ents = 0;
-}
-
-/* Free all the memory associated with MCTX. */
-
-static void
-match_ctx_free (mctx)
- re_match_context_t *mctx;
-{
- match_ctx_free_subtops (mctx);
- re_free (mctx->sub_tops);
- re_free (mctx->bkref_ents);
-}
-
-/* Free all the memory associated with MCTX->SUB_TOPS. */
-
-static void
-match_ctx_free_subtops (mctx)
- re_match_context_t *mctx;
-{
int st_idx;
for (st_idx = 0; st_idx < mctx->nsub_tops; ++st_idx)
{
@@ -4144,6 +4118,21 @@
}
free (top);
}
+
+ mctx->nsub_tops = 0;
+ mctx->nbkref_ents = 0;
+}
+
+/* Free all the memory associated with MCTX. */
+
+static void
+match_ctx_free (mctx)
+ re_match_context_t *mctx;
+{
+ /* First, free all the memory associated with MCTX->SUB_TOPS. */
+ match_ctx_clean (mctx);
+ re_free (mctx->sub_tops);
+ re_free (mctx->bkref_ents);
}
/* Add a new backreference entry to MCTX.
git-archimport-id: bonzini@gnu.org--2004b/sed--stable--4.1--patch-2
Diffstat (limited to 'lib')
-rw-r--r-- | lib/regexec.c | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/lib/regexec.c b/lib/regexec.c index b7b5b1a..9001823 100644 --- a/lib/regexec.c +++ b/lib/regexec.c @@ -22,8 +22,6 @@ static reg_errcode_t match_ctx_init (re_match_context_t *cache, int eflags, int n) internal_function; static void match_ctx_clean (re_match_context_t *mctx) internal_function; static void match_ctx_free (re_match_context_t *cache) internal_function; -static void match_ctx_free_subtops (re_match_context_t *mctx) - internal_function; static reg_errcode_t match_ctx_add_entry (re_match_context_t *cache, int node, int str_idx, int from, int to) internal_function; @@ -4079,28 +4077,6 @@ static void match_ctx_clean (mctx) re_match_context_t *mctx; { - match_ctx_free_subtops (mctx); - mctx->nsub_tops = 0; - mctx->nbkref_ents = 0; -} - -/* Free all the memory associated with MCTX. */ - -static void -match_ctx_free (mctx) - re_match_context_t *mctx; -{ - match_ctx_free_subtops (mctx); - re_free (mctx->sub_tops); - re_free (mctx->bkref_ents); -} - -/* Free all the memory associated with MCTX->SUB_TOPS. */ - -static void -match_ctx_free_subtops (mctx) - re_match_context_t *mctx; -{ int st_idx; for (st_idx = 0; st_idx < mctx->nsub_tops; ++st_idx) { @@ -4120,6 +4096,21 @@ match_ctx_free_subtops (mctx) } free (top); } + + mctx->nsub_tops = 0; + mctx->nbkref_ents = 0; +} + +/* Free all the memory associated with MCTX. */ + +static void +match_ctx_free (mctx) + re_match_context_t *mctx; +{ + /* First, free all the memory associated with MCTX->SUB_TOPS. */ + match_ctx_clean (mctx); + re_free (mctx->sub_tops); + re_free (mctx->bkref_ents); } /* Add a new backreference entry to MCTX. |