diff mbox series

[libnetfilter_queue,28/32] build: Get real & user times back to what they were

Message ID 20240315073347.22628-29-duncan_roe@optusnet.com.au
State New
Headers show
Series [libnetfilter_queue,01/32] src: Convert nfq_open() to use libmnl | expand

Commit Message

Duncan Roe March 15, 2024, 7:33 a.m. UTC
In build_man.sh, mygrep becomes mygrep2 and
all functions except fix_name_line use a new simpler mygrep.

Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
---
 doxygen/build_man.sh | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/doxygen/build_man.sh b/doxygen/build_man.sh
index b3d1989..5c1a019 100755
--- a/doxygen/build_man.sh
+++ b/doxygen/build_man.sh
@@ -251,7 +251,7 @@  fix_name_line(){
   head -n$linnum $target >$fileC
 
   while :
-  do mygrep ^\\.RI $fileC
+  do mygrep2 ^\\.RI $fileC
     [ $linnum -ne 0 ] || break
     # Discard this entry
     tail -n+$(($linnum + 1)) $fileC >$fileB
@@ -264,7 +264,7 @@  fix_name_line(){
 
   # macros (if any) come after functions
   while :
-  do mygrep '^\.SS "#' $fileC
+  do mygrep2 '^\.SS "#' $fileC
     [ $linnum -ne 0 ] || break
     tail -n+$(($linnum + 1)) $fileC >$fileB
     cp $fileB $fileC
@@ -314,6 +314,13 @@  delete_lines(){
 }
 
 mygrep(){
+  linnum=$(grep -En "$1" $2 2>/dev/null | head -n1 | cut -f1 -d:)
+  [ $linnum ] || linnum=0
+}
+
+# mygrep2 copies found line to $fileG. Only fix_name_line() needs this.
+# Using mygrep everywhere else gives a measurable CPU saving.
+mygrep2(){
   linnum=$(grep -En "$1" $2 2>/dev/null | head -n1 | tee $fileG | cut -f1 -d:)
   [ $linnum ] || linnum=0
 }