1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
Description: fix multiple issues gone fatal with gcc 14.
This patch casts a few types to nudge several PCREs to build properly,
given a number of mismatches or confusions between pcre2_code and
pcre2_compile_context. The most notable change is probably the
modified signature of str_re_new, as otherwise the code would have to
include a huge amount of type casts for each and every call of
str_re_new.
.
Upstream followed a different path to resolve the problem in upcoming
phast versions, so forwarding this patch has become irrelevant.
Author: Étienne Mollier <emollier@debian.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075383
Forwarded: not-needed
Last-Update: 2024-07-31
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/include/phast/stringsplus.h
+++ b/include/phast/stringsplus.h
@@ -383,7 +383,7 @@ int str_split(String *s, const char* del
expression syntax.
@result Newly allocated and compiled Regex object.
*/
-pcre2_code *str_re_new(const unsigned char *re_str);
+pcre2_compile_context *str_re_new(const unsigned char *re_str);
/** Free resources associated with regular expression object.
@param re Regex object to free
--- a/src/lib/base/phast_stringsplus.c
+++ b/src/lib/base/phast_stringsplus.c
@@ -463,12 +463,12 @@ int str_ends_with_charstr(String *s, con
return (strncmp(&s->chars[s->length - len], substr, len) == 0);
}
-pcre2_code *str_re_new(const unsigned char *re_str) {
- pcre2_code *re;
+pcre2_compile_context *str_re_new(const unsigned char *re_str) {
+ pcre2_compile_context *re;
int errorcode;
PCRE2_SIZE erroffset;
- re = pcre2_compile(re_str, PCRE2_ZERO_TERMINATED, 0, &errorcode, &erroffset, NULL);
+ re = (pcre2_compile_context *)pcre2_compile(re_str, PCRE2_ZERO_TERMINATED, 0, &errorcode, &erroffset, NULL);
if (re == NULL) {
die("ERROR: cannot compile regular expression '%s' (%d): %d\n",
re_str, erroffset, errorcode);
@@ -529,13 +529,13 @@ int str_re_match_sub(String *s, pcre2_co
int str_re_match(String *s, pcre2_compile_context *re, List *l, int nsubexp) {
- return str_re_match_sub(s, re, l, 0, nsubexp, NULL);
+ return str_re_match_sub(s, (pcre2_code *)re, l, 0, nsubexp, NULL);
}
int str_re_search(String *s, pcre2_compile_context *re, int start_offset, List *l,
int nsubexp) {
int first_match_idx, rc;
- rc = str_re_match_sub(s, re, l, start_offset, nsubexp, &first_match_idx);
+ rc = str_re_match_sub(s, (pcre2_code *)re, l, start_offset, nsubexp, &first_match_idx);
if (rc < 0) return rc;
return first_match_idx;
}
|