From 5d09374ed9f1588bdd7ca0233ff37b66a6c157ba Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Thu, 6 Nov 2025 00:39:39 +0100 Subject: [PATCH] src/bin/grepc_c: Use non-capturing groups where possible Signed-off-by: Alejandro Colomar --- src/bin/grepc_c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bin/grepc_c b/src/bin/grepc_c index 3269ba3fa..7ca51dda1 100755 --- a/src/bin/grepc_c +++ b/src/bin/grepc_c @@ -106,7 +106,7 @@ if test "$t" = 'no'; then fi; -grepc_c_t_sue_decl_() { printf '%s' '(?s)^([\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+)?\b(?:'"$1"')\b[\w \t[\]:]*(?\((?:[\w\s,;[\]*\?:+-]|(?¶ms))*(?:\.\.\.)?\))'; } grepc_c_f_decl_() { grepc_c_f_return_; @@ -114,7 +114,7 @@ grepc_c_f_decl_() { grepc_c_f_return_; grepc_c_f_params_; } grepc_c_body_() { printf '%s' '[ \t]*\n*(?[ \t]*){.*?^\k}'; } grepc_c_u_body_() { printf '%s' '[ \t]*\n*(?[ \t]*){(?:(?!^\k?}).)*'"$1"'.*?^\k}'; } -grepc_c_fld_decl_() { printf '%s' '(?s)^(COMPAT_)?SYSCALL_DEFINE.\('"$1"'\b[\w\s,;[\]*\?:+-]*\)'; } +grepc_c_fld_decl_() { printf '%s' '(?s)^(?:COMPAT_)?SYSCALL_DEFINE.\('"$1"'\b[\w\s,;[\]*\?:+-]*\)'; } grepc_c_m_decl_() { printf '%s' '(?s)^[ \t]*#\s*define\s[\s\\]*'"$1"'\b'; } grepc_c_mf_decl_() { grepc_c_m_decl_ "$1"; printf '%s' '\([^\(]*\)'; } @@ -149,9 +149,9 @@ grepc_c_t_braced() { grepc_c_t_sue_decl_ 'struct|union|enum' "$1"; grepc_c_body_; echo '[^;]*;'; } grepc_c_t_td_simple() { echo '(?s)^[ \t]*typedef\s+[^{};]+\b'"$1"';'; } -grepc_c_t_td_braced() { printf '%s' '(?s)^[ \t]*typedef\s+(struct|union|enum)\b[\w \t[\]:]*'; +grepc_c_t_td_braced() { printf '%s' '(?s)^[ \t]*typedef\s+(?:struct|union|enum)\b[\w \t[\]:]*'; grepc_c_body_; - echo '\s*'"$1"'(\[[\w\(,\)]\])*;'; } + echo '\s*'"$1"'(?:\[[\w\(,\)]\])*;'; } grepc_c_t_td_func() { echo '(?s)^[ \t]*typedef\s+[^{};]+\(\**'"$1"'\)\s*\([^{};]+;'; } grepc_c_ue() { grepc_c_t_sue_decl_ 'enum' ''; grepc_c_u_body_ "$1"; -- 2.47.3