enh: tpcre2 handle errcode
This commit is contained in:
parent
839eca2694
commit
a544662cd5
|
@ -8,7 +8,7 @@ int32_t doRegComp(pcre2_code** ppRegex, pcre2_match_data** ppMatchData, const ch
|
||||||
*ppRegex = pcre2_compile((PCRE2_SPTR8)pattern, PCRE2_ZERO_TERMINATED, options, &errorcode, &erroroffset, NULL);
|
*ppRegex = pcre2_compile((PCRE2_SPTR8)pattern, PCRE2_ZERO_TERMINATED, options, &errorcode, &erroroffset, NULL);
|
||||||
if (*ppRegex == NULL) {
|
if (*ppRegex == NULL) {
|
||||||
PCRE2_UCHAR buffer[256];
|
PCRE2_UCHAR buffer[256];
|
||||||
pcre2_get_error_message(errorcode, buffer, sizeof(buffer));
|
(void)pcre2_get_error_message(errorcode, buffer, sizeof(buffer));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ int32_t doRegExec(const char* pString, pcre2_code* pRegex, pcre2_match_data* pMa
|
||||||
ret = pcre2_match(pRegex, (PCRE2_SPTR)pString, PCRE2_ZERO_TERMINATED, 0, 0, pMatchData, NULL);
|
ret = pcre2_match(pRegex, (PCRE2_SPTR)pString, PCRE2_ZERO_TERMINATED, 0, 0, pMatchData, NULL);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
PCRE2_UCHAR buffer[256];
|
PCRE2_UCHAR buffer[256];
|
||||||
pcre2_get_error_message(ret, buffer, sizeof(buffer));
|
(void)pcre2_get_error_message(ret, buffer, sizeof(buffer));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue