Changeset: 5464cafb5ac4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5464cafb5ac4
Modified Files:
monetdb5/modules/mal/pcre.c
Branch: Jul2017
Log Message:
Remove unneeded buffers: somebody misunderstood the API of PCRE.
diffs (75 lines):
diff --git a/monetdb5/modules/mal/pcre.c b/monetdb5/modules/mal/pcre.c
--- a/monetdb5/modules/mal/pcre.c
+++ b/monetdb5/modules/mal/pcre.c
@@ -256,7 +256,7 @@ pcre_compile_wrap(pcre **res, const char
{
#ifdef HAVE_LIBPCRE
pcre *r;
- const char err[BUFSIZ], *err_p = err;
+ const char *err_p = NULL;
int errpos = 0;
int options = PCRE_UTF8 | PCRE_MULTILINE;
if (insensitive)
@@ -583,7 +583,7 @@ static str
pcre_replace(str *res, const char *origin_str, const char *pattern, const char
*replacement, const char *flags)
{
#ifdef HAVE_LIBPCRE
- const char err[BUFSIZ], *err_p = err, *err_p2 = err;
+ const char *err_p = NULL;
pcre *pcre_code = NULL;
pcre_extra *extra;
char *tmpres;
@@ -622,7 +622,7 @@ pcre_replace(str *res, const char *origi
* worth spending more time analyzing it in order to speed up the time
* taken for matching.
*/
- extra = pcre_study(pcre_code, 0, &err_p2);
+ extra = pcre_study(pcre_code, 0, &err_p);
pcre_fullinfo(pcre_code, extra, PCRE_INFO_CAPTURECOUNT, &i);
ovecsize = (i + 1) * 3;
if ((ovector = (int *) GDKmalloc(sizeof(int) * ovecsize)) == NULL) {
@@ -701,7 +701,7 @@ pcre_replace_bat(BAT **res, BAT *origin_
{
#ifdef HAVE_LIBPCRE
BATiter origin_strsi = bat_iterator(origin_strs);
- const char err[BUFSIZ], *err_p = err, *err_p2 = err;
+ const char *err_p = NULL;
int i, j, k, len, errpos = 0, offset = 0;
int compile_options = PCRE_UTF8, exec_options = PCRE_NOTEMPTY;
pcre *pcre_code = NULL;
@@ -740,7 +740,7 @@ pcre_replace_bat(BAT **res, BAT *origin_
/* Since the compiled pattern is ging to be used several times, it is
worth spending
* more time analyzing it in order to speed up the time taken for
matching.
*/
- extra = pcre_study(pcre_code, 0, &err_p2);
+ extra = pcre_study(pcre_code, 0, &err_p);
pcre_fullinfo(pcre_code, extra, PCRE_INFO_CAPTURECOUNT, &i);
ovecsize = (i + 1) * 3;
if ((ovector = (int *) GDKzalloc(sizeof(int) * ovecsize)) == NULL) {
@@ -864,7 +864,7 @@ pcre_match_with_flags(bit *ret, const ch
int i;
int pos;
#ifdef HAVE_LIBPCRE
- const char err[BUFSIZ], *err_p = err;
+ const char *err_p = NULL;
int errpos = 0;
int options = PCRE_UTF8;
pcre *re;
@@ -1312,7 +1312,7 @@ BATPCRElike3(bat *ret, const bat *bid, c
} else {
int pos;
#ifdef HAVE_LIBPCRE
- const char err[BUFSIZ], *err_p = err;
+ const char *err_p = NULL;
int errpos = 0;
int options = PCRE_UTF8 | PCRE_DOTALL;
pcre *re;
@@ -1594,7 +1594,7 @@ pcrejoin(BAT *r1, BAT *r2, BAT *l, BAT *
#ifdef HAVE_LIBPCRE
pcre *pcrere = NULL;
pcre_extra *pcreex = NULL;
- const char errbuf[BUFSIZ], *err_p = errbuf;
+ const char *err_p = NULL;
int errpos;
int pcreopt = PCRE_UTF8 | PCRE_MULTILINE;
#else
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list