From 9afd98d11b1cdf3501ef927b8b9a7efb78fa6f19 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Thu, 2 Nov 2023 19:38:43 +0100 Subject: bin/grepc: Simplify (remove grepc_use_type()) Signed-off-by: Alejandro Colomar --- bin/grepc | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/bin/grepc b/bin/grepc index 1fc1ce5..2c83624 100755 --- a/bin/grepc +++ b/bin/grepc @@ -26,7 +26,9 @@ t_type_td_func='no'; t_use_enum='no'; t_use_func='no'; t_use_macro='no'; -t_use_type='no'; +t_use_type_su='no'; +t_use_type_td_simple='no'; +t_use_type_td_su='no'; grepc_err() @@ -116,7 +118,9 @@ grepc_parse_cmd() t_use_enum='yes'; t_use_func='yes'; t_use_macro='yes'; - t_use_type='yes'; + t_use_type_su='yes'; + t_use_type_td_simple='yes'; + t_use_type_td_su='yes'; ;; ue) t_use_enum='yes'; @@ -128,7 +132,9 @@ grepc_parse_cmd() t_use_macro='yes'; ;; ut) - t_use_type='yes'; + t_use_type_su='yes'; + t_use_type_td_simple='yes'; + t_use_type_td_su='yes'; ;; *) grepc_err "-$opt: $OPTARG: Unknown argument."; @@ -374,7 +380,7 @@ grepc_use_macro() } -grepc_use_type_struct_union() +grepc_use_type_su() { grepc_helper_use \ "\b(struct|union)\b" \ @@ -383,7 +389,7 @@ grepc_use_type_struct_union() } -grepc_use_type_typedef_simple() +grepc_use_type_td_simple() { grepc_helper_use \ '^[ \t]*typedef\s' \ @@ -392,7 +398,7 @@ grepc_use_type_typedef_simple() } -grepc_use_type_typedef_struct_union() +grepc_use_type_td_su() { grepc_helper_use \ '^[ \t]*typedef\s+(struct|union)\b[^;]*$' \ @@ -401,14 +407,6 @@ grepc_use_type_typedef_struct_union() } -grepc_use_type() -{ - grepc_use_type_struct_union "$1"; - grepc_use_type_typedef_simple "$1"; - grepc_use_type_typedef_struct_union "$1"; -} - - grepc_search() { test "$t_enum" = 'yes' \ @@ -445,8 +443,12 @@ grepc_search() && grepc_use_func "$1"; test "$t_use_macro" = 'yes' \ && grepc_use_macro "$1"; - test "$t_use_type" = 'yes' \ - && grepc_use_type "$1"; + test "$t_use_type_su" = 'yes' \ + && grepc_use_type_su "$1"; + test "$t_use_type_td_simple" = 'yes' \ + && grepc_use_type_td_simple "$1"; + test "$t_use_type_td_su" = 'yes' \ + && grepc_use_type_td_su "$1"; } -- cgit v1.2.3