svn commit: r224897 - user/gabor/tre-integration/contrib/tre/lib
Gabor Kovesdan
gabor at FreeBSD.org
Mon Aug 15 18:49:43 UTC 2011
Author: gabor
Date: Mon Aug 15 18:49:42 2011
New Revision: 224897
URL: http://svn.freebsd.org/changeset/base/224897
Log:
- Do not limit pattern length
Modified:
user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c
user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.h
Modified: user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c Mon Aug 15 18:07:41 2011 (r224896)
+++ user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.c Mon Aug 15 18:49:42 2011 (r224897)
@@ -239,14 +239,24 @@ static int fastcmp(const void *, const v
*/
#define FILL_BMGS \
if (!fg->hasdot) \
- _FILL_BMGS(fg->sbmGs, fg->pattern, fg->len, false);
+ { \
+ fg->sbmGs = xmalloc(fg->len * sizeof(int)); \
+ if (!fg->sbmGs) \
+ return REG_ESPACE; \
+ _FILL_BMGS(fg->sbmGs, fg->pattern, fg->len, false); \
+ }
/*
* Fills in the good suffix table for wide strings.
*/
#define FILL_BMGS_WIDE \
if (!fg->hasdot) \
- _FILL_BMGS(fg->bmGs, fg->wpattern, fg->wlen, true);
+ { \
+ fg->bmGs = xmalloc(fg->wlen * sizeof(int)); \
+ if (!fg->bmGs) \
+ return REG_ESPACE; \
+ _FILL_BMGS(fg->bmGs, fg->wpattern, fg->wlen, true); \
+ }
#define _FILL_BMGS(arr, pat, plen, wide) \
{ \
@@ -634,8 +644,12 @@ tre_free_fast(fastmatch_t *fg)
#ifdef TRE_WCHAR
hashtable_free(fg->qsBc_table);
+ if (!fg->hasdot)
+ xfree(fg->bmGs);
xfree(fg->wpattern);
#endif
+ if (!fg->hasdot)
+ xfree(fg->sbmGs);
xfree(fg->pattern);
}
Modified: user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.h
==============================================================================
--- user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.h Mon Aug 15 18:07:41 2011 (r224896)
+++ user/gabor/tre-integration/contrib/tre/lib/tre-fastmatch.h Mon Aug 15 18:49:42 2011 (r224897)
@@ -35,21 +35,17 @@
#include "hashtable.h"
#include "tre-internal.h"
-#define BM_MAX_LEN 1024
-
typedef struct {
size_t wlen;
size_t len;
tre_char_t *wpattern;
int hasdot;
int qsBc[UCHAR_MAX + 1];
- int bmGs[BM_MAX_LEN];
-#ifdef TRE_WCHAR
+ int *bmGs;
char *pattern;
int defBc;
hashtable *qsBc_table;
- int sbmGs[BM_MAX_LEN];
-#endif
+ int *sbmGs;
/* flags */
bool bol;
bool eol;
More information about the svn-src-user
mailing list