Re: Strange segfault with improper usage --> plus extra fix for internal_trace issue in there
Paolo <[email protected]>
| Newsgroups | gmane.mail.spam.crm114 |
|---|---|
| Message-ID | <20080326215311.GQ20978@localhost> |
On Wed, Mar 26, 2008 at 06:02:08PM +0100, Ger Hobbelt wrote:
>
> BTW: bugreport: the first internal_trace dump loop in there has an
> indexing bug. diff attached: apply to your crmregex_tre.c as you have
> it. ;-)
oops, yes, reducing the 2 loops to 1 for final diff I left in the for() on
j instead of i - just do j->i on that line:
- j = 0;
-+ i=j=0;
+ if (internal_trace)
+ {
+ fprintf (stderr, "Checking the regex cache for '%s'\n", regex);
-+ for (j=0; j < CRM_REGEX_CACHESIZE; j++) {
++ for (i=0; i < CRM_REGEX_CACHESIZE; j++) {
+ if (regex_cache[i].regex_len > 0) fprintf (stderr,
+ " regex[%d]:'%s' cf=%#x(%#x) len=%d(%d)\n",
+ i,regex_cache[i].regex,regex_cache[i].cflags,cflags,
+ regex_cache[i].regex_len,regex_len);
+ }
#ifdef REGEX_CACHE_LINEAR_SEARCH
+ fputs (" [<- rex cache linear]\n", stderr);
+ }
++ i=j=0;
> - +#error "Must have #define'd ONE of these:
> REGEX_CACHE_RANDOM_ACCESS, REGEX_CACHE_LINEAR_SEARCH"
oh ... #ifdef...RANDOM is redundant, i left it in in case some other algo will
be devised - but so far we could really drop it: deafault is RANDOM, unless
LINEAR is defined.
> and some additional cruft:
I'm fine with them
thanks
--
paolo
GPG/PGP id:0x3A47DE45 - B5F9 AAA0 44BD 2B63 81E0 971F C6C0 0B87 3A47 DE45
- 9/11: the outrageous deception and ongoing coverup: http://911review.org -
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace