[med-svn] [Git][med-team/phast][master] Enhance patch for pcre2 but the code is incomplete

Andreas Tille (@tille) gitlab at salsa.debian.org
Thu Nov 18 18:42:31 GMT 2021



Andreas Tille pushed to branch master at Debian Med / phast


Commits:
ad7ab3e3 by Andreas Tille at 2021-11-18T19:42:00+01:00
Enhance patch for pcre2 but the code is incomplete

- - - - -


1 changed file:

- debian/patches/pcre2.patch


Changes:

=====================================
debian/patches/pcre2.patch
=====================================
@@ -88,7 +88,7 @@
  #include "phast/stringsplus.h"
  #include "phast/misc.h"
  #include <stdlib.h>
-@@ -462,29 +463,29 @@ int str_ends_with_charstr(String *s, con
+@@ -462,47 +463,51 @@ int str_ends_with_charstr(String *s, con
    return (strncmp(&s->chars[s->length - len], substr, len) == 0);
  }
  
@@ -124,17 +124,23 @@
  
  #define OVECCOUNT 300
 -int str_re_match_sub(String *s, Regex *re, List *l, int offset, int nsubexp, 
-+int str_re_match_sub(String *s, pcre2_compile_context *re, List *l, int offset, int nsubexp, 
++int str_re_match_sub(String *s, pcre2_code *re, List *l, int offset, int nsubexp, 
  		     int *first_match) {
    int i, len, rc, ovector[OVECCOUNT], rv;
    String *substr;
-@@ -494,15 +495,15 @@ int str_re_match_sub(String *s, Regex *r
++  pcre2_match_data *match_data = pcre2_match_data_create(OVECCOUNT, NULL);
+ 
+   /* WARNING: lst_clear DOES NOT free memory associated with the contents,
+      so must free substrings from previous calls if these are no longer being
       used or there will be a memory leak! */
    if (l != NULL) lst_clear(l);
  
 -  rc = pcre_exec(re, NULL, s->chars, s->length, offset, 0, ovector, OVECCOUNT);
 -  if (rc == PCRE_ERROR_NOMATCH) return -1;
-+  rc = pcre2_exec(re, NULL, s->chars, s->length, offset, 0, ovector, OVECCOUNT);
++  rc = pcre2_match(re, s->chars, s->length, offset, 0, match_data, NULL);
++  /* FIXME: The following code is broken and needs to be ported properly
++   *        to replace ovector used by pcre3 by match_data as in pcre2.
++   */
 +  if (rc == PCRE2_ERROR_NOMATCH) return -1;
    if (rc < 0) return -2;  //any other error
    if (first_match != NULL) (*first_match) = ovector[0];
@@ -147,7 +153,7 @@
        rc = OVECCOUNT/3;
      }
      for (i = 0; i < rc && i <= nsubexp; i++) {
-@@ -523,11 +524,11 @@ int str_re_match_sub(String *s, Regex *r
+@@ -523,11 +528,11 @@ int str_re_match_sub(String *s, Regex *r
  }
  
  



View it on GitLab: https://salsa.debian.org/med-team/phast/-/commit/ad7ab3e3573969cbb8d06a0fa0d109594d089ec0

-- 
View it on GitLab: https://salsa.debian.org/med-team/phast/-/commit/ad7ab3e3573969cbb8d06a0fa0d109594d089ec0
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20211118/206eb01a/attachment-0001.htm>


More information about the debian-med-commit mailing list