aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil/regex.c
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2021-12-13 22:46:36 +0000
committerJoão Valverde <j@v6e.pt>2021-12-13 23:57:32 +0000
commitfb0e1a49076a3268a5e8c29c46c8516a91a6cefe (patch)
tree2b0ab17c9a9b506623683c93b7fc34202a706e03 /wsutil/regex.c
parentff7a5c87e997d2839070b922fc5326feef89a37b (diff)
regex: Remove requirement for ssize_t
The type ssize_t is not available on Windows. Because this is used in the public API we must provide a definition for it. To avoid having to add a header to fix this use a size_t in the API instead, and assign SIZE_MAX to represent a null terminated string.
Diffstat (limited to 'wsutil/regex.c')
-rw-r--r--wsutil/regex.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/wsutil/regex.c b/wsutil/regex.c
index 83caa96291..0698df9161 100644
--- a/wsutil/regex.c
+++ b/wsutil/regex.c
@@ -83,13 +83,13 @@ ws_regex_compile(const char *patt, char **errmsg)
static bool
-match_pcre2(pcre2_code *code, const char *subj, ssize_t subj_size)
+match_pcre2(pcre2_code *code, const char *subj, size_t subj_size)
{
PCRE2_SIZE length;
pcre2_match_data *match_data;
int rc;
- length = subj_size < 0 ? PCRE2_ZERO_TERMINATED : (PCRE2_SIZE)subj_size;
+ length = subj_size == WS_REGEX_ZERO_TERMINATED ? PCRE2_ZERO_TERMINATED : (PCRE2_SIZE)subj_size;
/* We don't use the matched substring but pcre2_match requires
* at least one pair of offsets. */
@@ -123,7 +123,7 @@ match_pcre2(pcre2_code *code, const char *subj, ssize_t subj_size)
bool
-ws_regex_matches(const ws_regex_t *re, const char *subj, ssize_t subj_size)
+ws_regex_matches(const ws_regex_t *re, const char *subj, size_t subj_size)
{
ws_return_val_if_null(re, FALSE);
ws_return_val_if_null(subj, FALSE);