File hypermail-pcre2.patch of Package hypermail

Index: hypermail-2.2.0.20070131/Makefile.in
===================================================================
--- hypermail-2.2.0.20070131.orig/Makefile.in
+++ hypermail-2.2.0.20070131/Makefile.in
@@ -28,7 +28,7 @@ INSTALL_PROG=@INSTALL@
  
 # Compiler to use
 CC=@CC@ 
-CFLAGS=@CFLAGS@ @INCLUDES@ -Ipcre -DTRIO_MINIMAL $(WARNINGS)
+CFLAGS=@CFLAGS@ @INCLUDES@ -Ipcre2-8 -DTRIO_MINIMAL $(WARNINGS)
 LIBS=@LIBS@
 LDFLAGS=@LDFLAGS@ -Lpcre
 
Index: hypermail-2.2.0.20070131/src/Makefile.in
===================================================================
--- hypermail-2.2.0.20070131.orig/src/Makefile.in
+++ hypermail-2.2.0.20070131/src/Makefile.in
@@ -24,17 +24,17 @@ CC=@CC@
 # Installation program to use
 INSTALL_PROG=@INSTALL@ 
 
-SPLINTFLAGS=-Ipcre 
+SPLINTFLAGS=-Ipcre2-8
  
 #WNOERROR=-Werror
 #WARNINGS=$(WNOERROR) -ansi -pedantic -Wall -Wtraditional -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Dlint
 
-CFLAGS=@CFLAGS@ @INCLUDES@ -Ipcre -DTRIO_MINIMAL $(WARNINGS)
+CFLAGS=@CFLAGS@ @INCLUDES@ -Ipcre2-8 -DTRIO_MINIMAL $(WARNINGS)
 YACC=@YACC@
 NETLIBS=@LIBS@
 #LDFLAGS=@LDFLAGS@ -Lpcre/.libs
 LDFLAGS=@LDFLAGS@
-MISC_LIBS= -lm -lpcre
+MISC_LIBS= -lm -lpcre2-8
 OPT_LIBS=@EXTRA_LIBS@
 
 INCS=		domains.h hypermail.h lang.h proto.h \
Index: hypermail-2.2.0.20070131/src/struct.c
===================================================================
--- hypermail-2.2.0.20070131.orig/src/struct.c
+++ hypermail-2.2.0.20070131/src/struct.c
@@ -35,7 +35,8 @@ int rbs_bigtime = 0;
 #ifdef __LCC__
 #include "../lcc/pcre.h"
 #else
-#include <pcre.h>
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
 #endif
 #endif
 
@@ -1194,40 +1195,37 @@ int inlist_regex_pos(struct hmlist *list
     for (i = 0, tlist = listname; tlist != NULL; i++, tlist = tlist->next) {
 #ifdef HAVE_PCRE
 	int r;
-	const char *errptr;
-	int epos;
+	int errnum;
+	size_t epos;
 	int index = regex_index(listname, i);
-	static pcre *p, **pcre_list;
-	static pcre_extra *extra, **extra_list;
+  static pcre2_code *p, **pcre_list;
 	if (!pcre_list) {
 	    int n = regex_index(NULL, -1);
 	    int i;
-			pcre_list = (pcre **) emalloc(n * sizeof(pcre *));
-			extra_list = (pcre_extra **) emalloc(n * sizeof(pcre_extra *));
+			pcre_list = (pcre2_code **) emalloc(n * sizeof(pcre2_code *));
 	    for (i = 0; i < n; ++i) {
 	        pcre_list[i] = NULL;
-	        extra_list[i] = NULL;
 	    }
 	}
 	if ((p = pcre_list[index]) == NULL) {
-	    p = pcre_compile(tlist->val, 0, &errptr, &epos, NULL);
+	    p = pcre2_compile((PCRE2_SPTR)tlist->val, PCRE2_ZERO_TERMINATED, 0, &errnum, &epos, NULL);
 	    if (!p) {
-		snprintf(errmsg, sizeof(errmsg), "Error at position %d of regular expression '%s': %s", epos, tlist->val, errptr);
-		progerr(errmsg);
-	    }
-	    extra = pcre_study(p, 0, &errptr);
-	    if (errptr) {
-		snprintf(errmsg, sizeof(errmsg), "Error studying regular expression '%s': %s", tlist->val, errptr);
-		progerr(errmsg);
+        PCRE2_UCHAR buffer[256];
+        snprintf(errmsg, sizeof(errmsg), "Error at position %d of regular expression '%s': %s", epos, tlist->val, pcre2_get_error_message(errnum, buffer, sizeof(buffer)));
+        progerr(errmsg);
 	    }
 	    pcre_list[index] = p;
-	    extra_list[index] = extra;
 	}
-	extra = extra_list[index];
-	r = pcre_exec(p, extra, str, strlen(str), 0, 0, NULL, 0);
+  pcre2_match_data *match_data;
+  match_data = pcre2_match_data_create_from_pattern(p, NULL);
+
+	r = pcre2_match(p, str, strlen(str), 0, 0, match_data, NULL);
 	
-	if (r >= 0)
+	if (r >= 0) {
+      pcre2_match_data_free(match_data);
+      pcre2_code_free(p);
 	    return i;
+  }
 #else
 	static int warned = 0;
 	if (set_showprogress && !warned) {
openSUSE Build Service is sponsored by