[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 6/9] dfa: cache MB_CUR_MAX for dfaexec
From: |
Jim Meyering |
Subject: |
Re: [PATCH 6/9] dfa: cache MB_CUR_MAX for dfaexec |
Date: |
Wed, 17 Mar 2010 10:19:07 +0100 |
Paolo Bonzini wrote:
> * src/dfa.c (state_index, dfaexec): Use d->mb_cur_max.
> (dfainit): Initialize it.
> (free_mbdata): New, extracted out of dfafree.
> (dfafree): Use it.
Thanks.
This looks fine.
> +static void
> +free_mbdata (struct dfa *d)
> +{
> + int i;
Since I and J are always non-negative,
please declare them as "unsigned int".
> + free(d->multibyte_prop);
> + d->multibyte_prop = NULL;
> +
> + for (i = 0; i < d->nmbcsets; ++i)
> + {
> + int j;
> + struct mb_char_classes *p = &(d->mbcsets[i]);
> + free(p->chars);
> + free(p->ch_classes);
> + free(p->range_sts);
> + free(p->range_ends);
> +
> + for (j = 0; j < p->nequivs; ++j)
> + free(p->equivs[j]);
> + free(p->equivs);
> +
> + for (j = 0; j < p->ncoll_elems; ++j)
> + free(p->coll_elems[j]);
> + free(p->coll_elems);
...
> diff --git a/src/dfa.h b/src/dfa.h
> index b8eb0c2..89460aa 100644
> --- a/src/dfa.h
> +++ b/src/dfa.h
> @@ -278,6 +278,8 @@ struct dfa
> int nregexps; /* Count of parallel regexps being built
> with dfaparse(). */
> #ifdef MBS_SUPPORT
> + int mb_cur_max; /* Cached value of MB_CUR_MAX. */
I realize all of the other "counter-style" (or otherwise guaranteed
to be non-negative) members have type "int", but that is wrong.
They should all use unsigned types.
So please start by making mb_cur_max be "unsigned int".
> /* These stuff are used only if MB_CUR_MAX > 1 or multibyte environments.
> */
While you're there, you might want to 's/These stuff/The following/'
> int nmultibyte_prop;
> int *multibyte_prop;
- [PATCH 4/9] dfa: speed up handling of brackets, (continued)
- [PATCH 5/9] dfa: optimize simple character sets under UTF-8 charsets, Paolo Bonzini, 2010/03/14
- [PATCH 7/9] dfa: run simple UTF-8 regexps as a single-byte character set, Paolo Bonzini, 2010/03/14
- [PATCH 6/9] dfa: cache MB_CUR_MAX for dfaexec, Paolo Bonzini, 2010/03/14
- Re: [PATCH 6/9] dfa: cache MB_CUR_MAX for dfaexec,
Jim Meyering <=
- [PATCH 8/9] grep: remove check_multibyte_string, fix non-UTF8 missed match, Paolo Bonzini, 2010/03/14
- [PATCH 9/9] grep: match multibyte charsets line-by-line when using -i, Paolo Bonzini, 2010/03/14