]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
bin/grepc: -tuf: Reuse grepc_c_f_decl_() for the function declarator
authorAlejandro Colomar <alx@kernel.org>
Thu, 9 Oct 2025 19:03:23 +0000 (21:03 +0200)
committerAlejandro Colomar <alx@kernel.org>
Wed, 29 Oct 2025 20:29:29 +0000 (21:29 +0100)
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 <alx@kernel.org>
bin/grepc

index f7357220d526b4695cc3b2e1305238c686479c78..dea993a75aacef7fe7e71ad865272bbb322c7649 100755 (executable)
--- 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*(?<space>[ \t]*){(?:(?!^\k<space>?}).)*'"$1"'.*?^\k<space>}'; }
 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}.*?;'; }