From 86576b62f4c504dba87cbbd607088d69d6524233 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 6 Jan 2004 21:59:24 +0000 Subject: (regcomp): Fix comment typo. (regfree): Free preg->translate, clear buffer, allocated, fastmap and translate fields. (build_charclass, buld_charclass_op): Change first argument to unsigned RE_TRANSLATE_TYPE. --- posix/regcomp.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'posix/regcomp.c') diff --git a/posix/regcomp.c b/posix/regcomp.c index 6c0f79bdd6..6b4af54da8 100644 --- a/posix/regcomp.c +++ b/posix/regcomp.c @@ -109,7 +109,7 @@ static reg_errcode_t build_equiv_class (re_bitset_ptr_t sbcset, re_charset_t *mbcset, int *equiv_class_alloc, const unsigned char *name); -static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans, +static reg_errcode_t build_charclass (unsigned RE_TRANSLATE_TYPE trans, re_bitset_ptr_t sbcset, re_charset_t *mbcset, int *char_class_alloc, @@ -118,12 +118,13 @@ static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans, #else /* not RE_ENABLE_I18N */ static reg_errcode_t build_equiv_class (re_bitset_ptr_t sbcset, const unsigned char *name); -static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans, +static reg_errcode_t build_charclass (unsigned RE_TRANSLATE_TYPE trans, re_bitset_ptr_t sbcset, const unsigned char *class_name, reg_syntax_t syntax); #endif /* not RE_ENABLE_I18N */ -static bin_tree_t *build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans, +static bin_tree_t *build_charclass_op (re_dfa_t *dfa, + unsigned RE_TRANSLATE_TYPE trans, const unsigned char *class_name, const unsigned char *extra, int not, reg_errcode_t *err); @@ -502,7 +503,7 @@ regcomp (preg, pattern, cflags) /* We have already checked preg->fastmap != NULL. */ if (BE (ret == REG_NOERROR, 1)) /* Compute the fastmap now, since regexec cannot modify the pattern - buffer. This function nevers fails in this implementation. */ + buffer. This function never fails in this implementation. */ (void) re_compile_fastmap (preg); else { @@ -631,8 +632,14 @@ regfree (preg) re_dfa_t *dfa = (re_dfa_t *) preg->buffer; if (BE (dfa != NULL, 1)) free_dfa_content (dfa); + preg->buffer = NULL; + preg->allocated = 0; re_free (preg->fastmap); + preg->fastmap = NULL; + + re_free (preg->translate); + preg->translate = NULL; } #ifdef _LIBC weak_alias (__regfree, regfree) @@ -3401,7 +3408,7 @@ build_charclass (trans, sbcset, mbcset, char_class_alloc, class_name, syntax) #else /* not RE_ENABLE_I18N */ build_charclass (trans, sbcset, class_name, syntax) #endif /* not RE_ENABLE_I18N */ - RE_TRANSLATE_TYPE trans; + unsigned RE_TRANSLATE_TYPE trans; re_bitset_ptr_t sbcset; const unsigned char *class_name; reg_syntax_t syntax; @@ -3476,7 +3483,7 @@ build_charclass (trans, sbcset, class_name, syntax) static bin_tree_t * build_charclass_op (dfa, trans, class_name, extra, not, err) re_dfa_t *dfa; - RE_TRANSLATE_TYPE trans; + unsigned RE_TRANSLATE_TYPE trans; const unsigned char *class_name; const unsigned char *extra; int not; -- cgit v1.2.3