From 49106b58aa59aacc4a3c2f1f19fb4517d59ed50a Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Thu, 9 Oct 2025 21:03:23 +0200 Subject: [PATCH] bin/grepc: -tuf: Reuse grepc_c_f_decl_() for the function declarator It's slightly different than the regex we were using, but I can't see a reason for it. It was probably due to forgetting to improve this regex. Signed-off-by: Alejandro Colomar --- bin/grepc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/grepc b/bin/grepc index f7357220d..dea993a75 100755 --- a/bin/grepc +++ b/bin/grepc @@ -179,7 +179,7 @@ grepc_c_t_td_simple() { printf '%s\n' '(?s)^[ \t]*typedef\s+[^{};]+\b'"$1"';'; } grepc_c_t_td_braced() { printf '%s\n' '(?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() { printf '%s\n' '(?s)^[ \t]*typedef\s+[^{};]+\(\**'"$1"'\)\s*\([^{};]+;'; } grepc_c_ue() { printf '%s\n' '(?s)^([\w[]+[\w\s]*)?\benum\b([\w \t[\]]|::)*\n*([ \t]*){[^}]*^\s*\w+[\w\s[\]=]*'"$1"'.*?^\3}.*?;'; } -grepc_c_uf_def() { printf '%s\n' '(?s)^[\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+\**\w+\s*\(([\w\s\(,\)[\]*]|::)+?(\.\.\.)?\)[ \t]*\n*([ \t]*){(?:(?!^\4?}).)*'"$1"'.*?^\4}'; } +grepc_c_uf_def() { grepc_c_f_decl_ '\w+'; printf '%s\n' '[ \t]*\n*(?[ \t]*){(?:(?!^\k?}).)*'"$1"'.*?^\k}'; } grepc_c_uf_linux_def() { printf '%s\n' '(?s)^(COMPAT_)?SYSCALL_DEFINE.\(\w+\b(?:(?!^}).)*'"$1"'.?^}'; } grepc_c_um() { printf '%s\n' '(?s)^[ \t]*#\s*define\s[\s\\]*\w+\b(\([^\)]*\))?(?:(?![^\\]$).)*'"$1"'.*?[^\\]$'; } grepc_c_ut_su() { printf '%s\n' '(?s)^(?!^[ \t]*typedef\b)([\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+)?\b(struct|union)\b([\w \t[\]]|::)*\w+[ \t]*\n*([ \t]*){(?:(?!^\5?}).)*?'"$1"'.*?^\5}.*?;'; } -- 2.47.3