]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
Use recursion to improve matching of function parameter lists
authorAlejandro Colomar <alx@kernel.org>
Sun, 8 Jan 2023 14:26:09 +0000 (15:26 +0100)
committerAlejandro Colomar <alx@kernel.org>
Wed, 29 Oct 2025 20:29:10 +0000 (21:29 +0100)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
bin/grepc

index 8e55e1a807db68182e011415c974b192b43dbad9..758349e1b838699aba2fbfac079aa7fc2537183e 100755 (executable)
--- a/bin/grepc
+++ b/bin/grepc
@@ -204,18 +204,18 @@ grepc_enum_constant()
 grepc_func_proto()
 {
        grepc_helper \
-         "\b$1\s*\(" \
+         "(\($1\)|\b$1)\s*\(" \
          '.' \
-         '(?s)^[\w[]([\w\s\(,\)[\]*]|::)+[\w\s\)*\]]\s+\**\(?'"$1"'\)?\s*\(([\w\s\(,\)[\]*]|::)+?(\.\.\.)?\)([\w\s\(,\)[\]]|::)*;';
+         '(?s)^[\w[](?:[\w\s\(,\)[\]*]|::)+[\w\s\)*\]]\s+\**\(?'"$1"'\)?\s*(\((?:[\w\s,[\]*]|::|(?1))*(?:\.\.\.)?\))(?:[\w\s\(,\)[\]]|::)*;';
 }
 
 
 grepc_func_def()
 {
        grepc_helper \
-         "\b$1\s*\(" \
+         "(\($1\)|\b$1)\s*\(" \
          '.' \
-         '(?s)^[\w[]([\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+\**\(?'"$1"'\)?\s*\(([\w\s\(,\)[\]*]|::)+?(\.\.\.)?\)[ \t]*\n([ \t]*){.*?^\4}';
+         '(?s)^[\w[](?:[\w\s\(,\)[\]*]|::)*[\w\s\)*\]]\s+\**\(?'"$1"'\)?\s*(\((?:[\w\s,[\]*]|::|(?1))*(?:\.\.\.)?\))[ \t]*\n([ \t]*){.*?^\2}';
 }