From: Philippe Antoine Date: Mon, 20 Sep 2021 20:02:50 +0000 (+0200) Subject: pcre2: follow code naming style X-Git-Tag: suricata-7.0.0-beta1~1341 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56f664af6b39f3172e12c89b556869f7acda5ea5;p=thirdparty%2Fsuricata.git pcre2: follow code naming style --- diff --git a/src/detect-byte-extract.c b/src/detect-byte-extract.c index 49f2c4bae8..7c1ba2182a 100644 --- a/src/detect-byte-extract.c +++ b/src/detect-byte-extract.c @@ -284,7 +284,7 @@ static inline DetectByteExtractData *DetectByteExtractParse(DetectEngineCtx *de_ for (i = 4; i < ret; i++) { char opt_str[64] = ""; pcre2len = sizeof(opt_str); - res = SC_pcre2_substring_copy(parse_regex.match, i, (PCRE2_UCHAR8 *)opt_str, &pcre2len); + res = SC_Pcre2SubstringCopy(parse_regex.match, i, (PCRE2_UCHAR8 *)opt_str, &pcre2len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed " diff --git a/src/detect-bytemath.c b/src/detect-bytemath.c index 7a46f5ebd0..316a4e0413 100644 --- a/src/detect-bytemath.c +++ b/src/detect-bytemath.c @@ -399,7 +399,7 @@ static DetectByteMathData *DetectByteMathParse(DetectEngineCtx *de_ctx, const ch if (ret > RELATIVE_KW) { pcre2len = sizeof(tmp_str); - res = SC_pcre2_substring_copy( + res = SC_Pcre2SubstringCopy( parse_regex.match, RELATIVE_KW, (PCRE2_UCHAR8 *)tmp_str, &pcre2len); if (res < 0) { @@ -415,7 +415,7 @@ static DetectByteMathData *DetectByteMathParse(DetectEngineCtx *de_ctx, const ch if (ret > ENDIAN_VAL) { pcre2len = sizeof(tmp_str); - res = SC_pcre2_substring_copy( + res = SC_Pcre2SubstringCopy( parse_regex.match, ENDIAN_KW, (PCRE2_UCHAR8 *)tmp_str, &pcre2len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed " @@ -428,7 +428,7 @@ static DetectByteMathData *DetectByteMathParse(DetectEngineCtx *de_ctx, const ch } pcre2len = sizeof(tmp_str); - res = SC_pcre2_substring_copy( + res = SC_Pcre2SubstringCopy( parse_regex.match, ENDIAN_VAL, (PCRE2_UCHAR8 *)tmp_str, &pcre2len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed " @@ -445,7 +445,7 @@ static DetectByteMathData *DetectByteMathParse(DetectEngineCtx *de_ctx, const ch if (ret > STRING_VAL) { pcre2len = sizeof(tmp_str); - res = SC_pcre2_substring_copy( + res = SC_Pcre2SubstringCopy( parse_regex.match, STRING_KW, (PCRE2_UCHAR8 *)tmp_str, &pcre2len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed " @@ -458,7 +458,7 @@ static DetectByteMathData *DetectByteMathParse(DetectEngineCtx *de_ctx, const ch } pcre2len = sizeof(tmp_str); - res = SC_pcre2_substring_copy( + res = SC_Pcre2SubstringCopy( parse_regex.match, STRING_VAL, (PCRE2_UCHAR8 *)tmp_str, &pcre2len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed " @@ -478,8 +478,7 @@ static DetectByteMathData *DetectByteMathParse(DetectEngineCtx *de_ctx, const ch if (ret > DCE_KW) { pcre2len = sizeof(tmp_str); - res = SC_pcre2_substring_copy( - parse_regex.match, DCE_KW, (PCRE2_UCHAR8 *)tmp_str, &pcre2len); + res = SC_Pcre2SubstringCopy(parse_regex.match, DCE_KW, (PCRE2_UCHAR8 *)tmp_str, &pcre2len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed " "for byte_math \"dce\" arg"); diff --git a/src/detect-dsize.c b/src/detect-dsize.c index 962b98404f..62c0b58f77 100644 --- a/src/detect-dsize.c +++ b/src/detect-dsize.c @@ -156,7 +156,7 @@ static DetectDsizeData *DetectDsizeParse (const char *rawstr) } pcre2len = sizeof(mode); - res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len); + res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed with %d", res); goto error; diff --git a/src/detect-filesize.c b/src/detect-filesize.c index 87cf12793d..eb79407279 100644 --- a/src/detect-filesize.c +++ b/src/detect-filesize.c @@ -158,7 +158,7 @@ static DetectFilesizeData *DetectFilesizeParse (const char *str) SCLogDebug("ret %d", ret); - res = SC_pcre2_substring_get(parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); + res = SC_Pcre2SubstringGet(parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed"); goto error; diff --git a/src/detect-flow.c b/src/detect-flow.c index d2edbe2704..d4e095f9d1 100644 --- a/src/detect-flow.c +++ b/src/detect-flow.c @@ -185,7 +185,7 @@ static DetectFlowData *DetectFlowParse (DetectEngineCtx *de_ctx, const char *flo if (ret > 1) { pcre2len = sizeof(str1); - res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)str1, &pcre2len); + res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)str1, &pcre2len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed"); goto error; diff --git a/src/detect-fragbits.c b/src/detect-fragbits.c index f5866815a7..94d2654950 100644 --- a/src/detect-fragbits.c +++ b/src/detect-fragbits.c @@ -183,8 +183,7 @@ static DetectFragBitsData *DetectFragBitsParse (const char *rawstr) } for (i = 0; i < (ret - 1); i++) { - res = SC_pcre2_substring_get( - parse_regex.match, i + 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); + res = SC_Pcre2SubstringGet(parse_regex.match, i + 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed %d", res); goto error; diff --git a/src/detect-fragoffset.c b/src/detect-fragoffset.c index d8647f3774..fcfdcc000f 100644 --- a/src/detect-fragoffset.c +++ b/src/detect-fragoffset.c @@ -156,7 +156,7 @@ static DetectFragOffsetData *DetectFragOffsetParse (DetectEngineCtx *de_ctx, con } for (i = 1; i < ret; i++) { - res = SC_pcre2_substring_get(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); + res = SC_Pcre2SubstringGet(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed"); goto error; diff --git a/src/detect-icmp-id.c b/src/detect-icmp-id.c index 3dea8ad4fa..7e943ca0b4 100644 --- a/src/detect-icmp-id.c +++ b/src/detect-icmp-id.c @@ -172,7 +172,7 @@ static DetectIcmpIdData *DetectIcmpIdParse (DetectEngineCtx *de_ctx, const char int i; const char *str_ptr; for (i = 1; i < ret; i++) { - res = SC_pcre2_substring_get(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); + res = SC_Pcre2SubstringGet(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed"); goto error; diff --git a/src/detect-icmp-seq.c b/src/detect-icmp-seq.c index 707eab7e03..d4f2fcf7b2 100644 --- a/src/detect-icmp-seq.c +++ b/src/detect-icmp-seq.c @@ -174,7 +174,7 @@ static DetectIcmpSeqData *DetectIcmpSeqParse (DetectEngineCtx *de_ctx, const cha } for (i = 1; i < ret; i++) { - res = SC_pcre2_substring_get(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); + res = SC_Pcre2SubstringGet(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed"); goto error; diff --git a/src/detect-icode.c b/src/detect-icode.c index e106ea2c1f..814db8efec 100644 --- a/src/detect-icode.c +++ b/src/detect-icode.c @@ -163,7 +163,7 @@ static DetectICodeData *DetectICodeParse(DetectEngineCtx *de_ctx, const char *ic int i; const char *str_ptr; for (i = 1; i < ret; i++) { - res = SC_pcre2_substring_get(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); + res = SC_Pcre2SubstringGet(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed"); goto error; diff --git a/src/detect-itype.c b/src/detect-itype.c index 9663f194a5..4b2ac13a40 100644 --- a/src/detect-itype.c +++ b/src/detect-itype.c @@ -163,7 +163,7 @@ static DetectITypeData *DetectITypeParse(DetectEngineCtx *de_ctx, const char *it int i; const char *str_ptr; for (i = 1; i < ret; i++) { - res = SC_pcre2_substring_get(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); + res = SC_Pcre2SubstringGet(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed"); goto error; diff --git a/src/detect-nfs-procedure.c b/src/detect-nfs-procedure.c index 22d0097f73..782ac9486c 100644 --- a/src/detect-nfs-procedure.c +++ b/src/detect-nfs-procedure.c @@ -218,7 +218,7 @@ static DetectNfsProcedureData *DetectNfsProcedureParse (const char *rawstr) } pcre2len = sizeof(mode); - res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len); + res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed"); goto error; diff --git a/src/detect-nfs-version.c b/src/detect-nfs-version.c index 63b4345eb8..f30c308743 100644 --- a/src/detect-nfs-version.c +++ b/src/detect-nfs-version.c @@ -209,7 +209,7 @@ static DetectNfsVersionData *DetectNfsVersionParse (const char *rawstr) } pcre2len = sizeof(mode); - res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len); + res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed"); goto error; diff --git a/src/detect-parse.c b/src/detect-parse.c index e4491d8e12..3e4f1a225c 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -2531,7 +2531,7 @@ DetectParseRegex *DetectSetupPCRE2(const char *parse_str, int opts) return detect_parse; } -int SC_pcre2_substring_copy( +int SC_Pcre2SubstringCopy( pcre2_match_data *match_data, uint32_t number, PCRE2_UCHAR *buffer, PCRE2_SIZE *bufflen) { int r = pcre2_substring_copy_bynumber(match_data, number, buffer, bufflen); @@ -2543,7 +2543,7 @@ int SC_pcre2_substring_copy( return r; } -int SC_pcre2_substring_get( +int SC_Pcre2SubstringGet( pcre2_match_data *match_data, uint32_t number, PCRE2_UCHAR **bufferptr, PCRE2_SIZE *bufflen) { int r = pcre2_substring_get_bynumber(match_data, number, bufferptr, bufflen); diff --git a/src/detect-parse.h b/src/detect-parse.h index 049b130996..021dcbf4b8 100644 --- a/src/detect-parse.h +++ b/src/detect-parse.h @@ -96,9 +96,9 @@ void DetectParseFreeRegex(DetectParseRegex *r); /* parse regex exec */ int DetectParsePcreExec( DetectParseRegex *parse_regex, const char *str, int start_offset, int options); -int SC_pcre2_substring_copy( +int SC_Pcre2SubstringCopy( pcre2_match_data *match_data, uint32_t number, PCRE2_UCHAR *buffer, PCRE2_SIZE *bufflen); -int SC_pcre2_substring_get(pcre2_match_data *match_data, uint32_t number, PCRE2_UCHAR **bufferptr, +int SC_Pcre2SubstringGet(pcre2_match_data *match_data, uint32_t number, PCRE2_UCHAR **bufferptr, PCRE2_SIZE *bufflen); #endif /* __DETECT_PARSE_H__ */ diff --git a/src/detect-rfb-sectype.c b/src/detect-rfb-sectype.c index d55965e78b..f6ac936c60 100644 --- a/src/detect-rfb-sectype.c +++ b/src/detect-rfb-sectype.c @@ -174,7 +174,7 @@ static DetectRfbSectypeData *DetectRfbSectypeParse (const char *rawstr) } pcre2len = sizeof(mode); - res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len); + res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed"); goto error; diff --git a/src/detect-snmp-version.c b/src/detect-snmp-version.c index 56e12cf455..d42f3eef0d 100644 --- a/src/detect-snmp-version.c +++ b/src/detect-snmp-version.c @@ -188,7 +188,7 @@ static DetectSNMPVersionData *DetectSNMPVersionParse (const char *rawstr) } pcre2len = sizeof(mode); - res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len); + res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed"); goto error; diff --git a/src/detect-tcp-flags.c b/src/detect-tcp-flags.c index 9a1b67392d..505254852d 100644 --- a/src/detect-tcp-flags.c +++ b/src/detect-tcp-flags.c @@ -189,7 +189,7 @@ static DetectFlagsData *DetectFlagsParse (const char *rawstr) } pcre2len = sizeof(arg1); - res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)arg1, &pcre2len); + res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)arg1, &pcre2len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed"); SCReturnPtr(NULL, "DetectFlagsData"); @@ -204,7 +204,7 @@ static DetectFlagsData *DetectFlagsParse (const char *rawstr) } if (ret >= 3) { pcre2len = sizeof(arg3); - res = SC_pcre2_substring_copy(parse_regex.match, 3, (PCRE2_UCHAR8 *)arg3, &pcre2len); + res = SC_Pcre2SubstringCopy(parse_regex.match, 3, (PCRE2_UCHAR8 *)arg3, &pcre2len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed"); SCReturnPtr(NULL, "DetectFlagsData"); diff --git a/src/detect-tcp-window.c b/src/detect-tcp-window.c index 97d1c9a6f3..de25663db9 100644 --- a/src/detect-tcp-window.c +++ b/src/detect-tcp-window.c @@ -127,7 +127,7 @@ static DetectWindowData *DetectWindowParse(DetectEngineCtx *de_ctx, const char * if (ret > 1) { char copy_str[128] = ""; pcre2len = sizeof(copy_str); - res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)copy_str, &pcre2len); + res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)copy_str, &pcre2len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed"); goto error; diff --git a/src/detect-tls-cert-validity.c b/src/detect-tls-cert-validity.c index d89cf09ab4..7be4d5bdf8 100644 --- a/src/detect-tls-cert-validity.c +++ b/src/detect-tls-cert-validity.c @@ -319,7 +319,7 @@ static DetectTlsValidityData *DetectTlsValidityParse (const char *rawstr) } pcre2len = sizeof(mode); - res = SC_pcre2_substring_copy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len); + res = SC_Pcre2SubstringCopy(parse_regex.match, 1, (PCRE2_UCHAR8 *)mode, &pcre2len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_copy_bynumber failed"); goto error; diff --git a/src/detect-urilen.c b/src/detect-urilen.c index e9127ee854..feb61d2acb 100644 --- a/src/detect-urilen.c +++ b/src/detect-urilen.c @@ -108,7 +108,7 @@ static DetectUrilenData *DetectUrilenParse (const char *urilenstr) SCLogDebug("ret %d", ret); - res = SC_pcre2_substring_get(parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); + res = SC_Pcre2SubstringGet(parse_regex.match, 1, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed"); goto error; @@ -125,7 +125,7 @@ static DetectUrilenData *DetectUrilenParse (const char *urilenstr) SCLogDebug("Arg2 \"%s\"", arg2); if (ret > 3) { - res = SC_pcre2_substring_get(parse_regex.match, 3, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); + res = SC_Pcre2SubstringGet(parse_regex.match, 3, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed"); goto error; @@ -134,8 +134,7 @@ static DetectUrilenData *DetectUrilenParse (const char *urilenstr) SCLogDebug("Arg3 \"%s\"", arg3); if (ret > 4) { - res = SC_pcre2_substring_get( - parse_regex.match, 4, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); + res = SC_Pcre2SubstringGet(parse_regex.match, 4, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len); if (res < 0) { SCLogError(SC_ERR_PCRE_GET_SUBSTRING, "pcre2_substring_get_bynumber failed"); goto error;