MEDIUM: regex: replace all standard regex function by own functions
This patch remove all references of standard regex in haproxy. The last
remaining references are only in the regex.[ch] files.
In the file src/checks.c, the original function uses a "pmatch" array.
In fact this array is unused. This patch remove it.
diff --git a/include/common/regex.h b/include/common/regex.h
index cec68c8..29a6ace 100644
--- a/include/common/regex.h
+++ b/include/common/regex.h
@@ -60,7 +60,7 @@
struct hdr_exp {
struct hdr_exp *next;
- const regex_t *preg; /* expression to look for */
+ struct my_regex *preg; /* expression to look for */
int action; /* ACT_ALLOW, ACT_REPLACE, ACT_REMOVE, ACT_DENY */
const char *replace; /* expression to set instead */
void *cond; /* a possible condition or NULL */
@@ -81,7 +81,7 @@
int regex_comp(const char *str, struct my_regex *regex, int cs, int cap, char **err);
int exp_replace(char *dst, unsigned int dst_size, char *src, const char *str, const regmatch_t *matches);
const char *check_replace_string(const char *str);
-const char *chain_regex(struct hdr_exp **head, const regex_t *preg,
+const char *chain_regex(struct hdr_exp **head, struct my_regex *preg,
int action, const char *replace, void *cond);
/* If the function doesn't match, it returns false, else it returns true.
diff --git a/include/types/checks.h b/include/types/checks.h
index d5038eb..a50043b 100644
--- a/include/types/checks.h
+++ b/include/types/checks.h
@@ -177,7 +177,7 @@
/* sent string is string */
char *string; /* sent or expected string */
int string_len; /* string lenght */
- regex_t *expect_regex; /* expected */
+ struct my_regex *expect_regex; /* expected */
int inverse; /* 0 = regular match, 1 = inverse match */
unsigned short port; /* port to connect to */
unsigned short conn_opts; /* options when setting up a new connection */
diff --git a/include/types/proto_http.h b/include/types/proto_http.h
index ff196a0..affc231 100644
--- a/include/types/proto_http.h
+++ b/include/types/proto_http.h
@@ -419,7 +419,7 @@
char *name; /* header name */
int name_len; /* header name's length */
struct list fmt; /* log-format compatible expression */
- regex_t* re; /* used by replace-header and replace-value */
+ struct my_regex re; /* used by replace-header and replace-value */
} hdr_add; /* args used by "add-header" and "set-header" */
struct redirect_rule *redir; /* redirect rule or "http-request redirect" */
int nice; /* nice value for HTTP_REQ_ACT_SET_NICE */
@@ -445,7 +445,7 @@
char *name; /* header name */
int name_len; /* header name's length */
struct list fmt; /* log-format compatible expression */
- regex_t* re; /* used by replace-header and replace-value */
+ struct my_regex re; /* used by replace-header and replace-value */
} hdr_add; /* args used by "add-header" and "set-header" */
int nice; /* nice value for HTTP_RES_ACT_SET_NICE */
int loglevel; /* log-level value for HTTP_RES_ACT_SET_LOGL */
diff --git a/include/types/proxy.h b/include/types/proxy.h
index 33524f3..b33b634 100644
--- a/include/types/proxy.h
+++ b/include/types/proxy.h
@@ -343,7 +343,7 @@
char *check_req; /* HTTP or SSL request to use for PR_O_HTTP_CHK|PR_O_SSL3_CHK */
int check_len; /* Length of the HTTP or SSL3 request */
char *expect_str; /* http-check expected content : string or text version of the regex */
- regex_t *expect_regex; /* http-check expected content */
+ struct my_regex *expect_regex; /* http-check expected content */
struct chunk errmsg[HTTP_ERR_SIZE]; /* default or customized error messages for known errors */
int uuid; /* universally unique proxy ID, used for SNMP */
unsigned int backlog; /* force the frontend's listen backlog */