(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.
This commit is contained in:
Ulrich Drepper 2004-01-06 21:59:24 +00:00
parent 763c0490a2
commit 86576b62f4
1 changed files with 13 additions and 6 deletions

View File

@ -109,7 +109,7 @@ static reg_errcode_t build_equiv_class (re_bitset_ptr_t sbcset,
re_charset_t *mbcset, re_charset_t *mbcset,
int *equiv_class_alloc, int *equiv_class_alloc,
const unsigned char *name); 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_bitset_ptr_t sbcset,
re_charset_t *mbcset, re_charset_t *mbcset,
int *char_class_alloc, int *char_class_alloc,
@ -118,12 +118,13 @@ static reg_errcode_t build_charclass (RE_TRANSLATE_TYPE trans,
#else /* not RE_ENABLE_I18N */ #else /* not RE_ENABLE_I18N */
static reg_errcode_t build_equiv_class (re_bitset_ptr_t sbcset, static reg_errcode_t build_equiv_class (re_bitset_ptr_t sbcset,
const unsigned char *name); 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_bitset_ptr_t sbcset,
const unsigned char *class_name, const unsigned char *class_name,
reg_syntax_t syntax); reg_syntax_t syntax);
#endif /* not RE_ENABLE_I18N */ #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 *class_name,
const unsigned char *extra, int not, const unsigned char *extra, int not,
reg_errcode_t *err); reg_errcode_t *err);
@ -502,7 +503,7 @@ regcomp (preg, pattern, cflags)
/* We have already checked preg->fastmap != NULL. */ /* We have already checked preg->fastmap != NULL. */
if (BE (ret == REG_NOERROR, 1)) if (BE (ret == REG_NOERROR, 1))
/* Compute the fastmap now, since regexec cannot modify the pattern /* 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); (void) re_compile_fastmap (preg);
else else
{ {
@ -631,8 +632,14 @@ regfree (preg)
re_dfa_t *dfa = (re_dfa_t *) preg->buffer; re_dfa_t *dfa = (re_dfa_t *) preg->buffer;
if (BE (dfa != NULL, 1)) if (BE (dfa != NULL, 1))
free_dfa_content (dfa); free_dfa_content (dfa);
preg->buffer = NULL;
preg->allocated = 0;
re_free (preg->fastmap); re_free (preg->fastmap);
preg->fastmap = NULL;
re_free (preg->translate);
preg->translate = NULL;
} }
#ifdef _LIBC #ifdef _LIBC
weak_alias (__regfree, regfree) weak_alias (__regfree, regfree)
@ -3401,7 +3408,7 @@ build_charclass (trans, sbcset, mbcset, char_class_alloc, class_name, syntax)
#else /* not RE_ENABLE_I18N */ #else /* not RE_ENABLE_I18N */
build_charclass (trans, sbcset, class_name, syntax) build_charclass (trans, sbcset, class_name, syntax)
#endif /* not RE_ENABLE_I18N */ #endif /* not RE_ENABLE_I18N */
RE_TRANSLATE_TYPE trans; unsigned RE_TRANSLATE_TYPE trans;
re_bitset_ptr_t sbcset; re_bitset_ptr_t sbcset;
const unsigned char *class_name; const unsigned char *class_name;
reg_syntax_t syntax; reg_syntax_t syntax;
@ -3476,7 +3483,7 @@ build_charclass (trans, sbcset, class_name, syntax)
static bin_tree_t * static bin_tree_t *
build_charclass_op (dfa, trans, class_name, extra, not, err) build_charclass_op (dfa, trans, class_name, extra, not, err)
re_dfa_t *dfa; re_dfa_t *dfa;
RE_TRANSLATE_TYPE trans; unsigned RE_TRANSLATE_TYPE trans;
const unsigned char *class_name; const unsigned char *class_name;
const unsigned char *extra; const unsigned char *extra;
int not; int not;