From 1c3c97b5bb36120405fdab9c065c20ed8222e918 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Wed, 5 Nov 2025 16:27:26 +0100 Subject: [PATCH] src/bin/grepc_c: -tuf: Split regex for the function body Signed-off-by: Alejandro Colomar --- src/bin/grepc_c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bin/grepc_c b/src/bin/grepc_c index 551055de2..7220e08cf 100755 --- a/src/bin/grepc_c +++ b/src/bin/grepc_c @@ -134,8 +134,10 @@ grepc_c_t_td_simple() { echo '(?s)^[ \t]*typedef\s+[^{};]+\b'"$1"';'; } grepc_c_t_td_braced() { echo '(?s)^[ \t]*typedef\s+(struct|union|enum)\b(?:(?!\W'"$1"'\W)([\w \t[\]]|::))*\n*([ \t]*){(?:(?!^\3?}).)*?^\3}\s*'"$1"'(\[[\w\(,\)]\])*;'; } grepc_c_t_td_func() { echo '(?s)^[ \t]*typedef\s+[^{};]+\(\**'"$1"'\)\s*\([^{};]+;'; } grepc_c_ue() { echo '(?s)^([\w[]+[\w\s]*)?\benum\b([\w \t[\]]|::)*\n*([ \t]*){[^}]*^\s*\w+[\w\s[\]=]*'"$1"'.*?^\3}.*?;'; } +grepc_c_uf_body_() { printf '%s' '[ \t]*\n*(?[ \t]*){(?:(?!^\k?}).)*'"$1"'.*?^\k}'; } grepc_c_uf_def() { grepc_c_f_decl_ '\w+'; - echo '[ \t]*\n*(?[ \t]*){(?:(?!^\k?}).)*'"$1"'.*?^\k}'; } + grepc_c_uf_body_ "$1"; + echo; } grepc_c_uf_linux_def() { grepc_c_fld_decl_ '\w+'; echo '(?:(?!^}).)*'"$1"'.*?^}'; } grepc_c_um() { echo '(?s)^[ \t]*#\s*define\s[\s\\]*\w+\b(\([^\)]*\))?(?:(?![^\\]$).)*'"$1"'.*?[^\\]$'; } -- 2.47.3