From: Beat Bolli Date: Sat, 17 Aug 2024 15:34:14 +0000 (+0200) Subject: check-format-commit: call fewer unneeded processes X-Git-Tag: openssl-3.0.16~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc53f9fc576a7265f9f958211212f454b3846d08;p=thirdparty%2Fopenssl.git check-format-commit: call fewer unneeded processes `wc` does not output a file name if the input is stdin. `awk` reads its file argument; there's no need for `cat`. `sort -u` outputs unique lines. It should be supported on all platforms, as it's specified by POSIX. Reviewed-by: Richard Levitte Reviewed-by: Neil Horman Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/25562) (cherry picked from commit 0d6544cdf845f7950c50680059c976cb507b6e45) --- diff --git a/util/check-format-commit.sh b/util/check-format-commit.sh index 93f5c22bfcb..cf958923fa0 100755 --- a/util/check-format-commit.sh +++ b/util/check-format-commit.sh @@ -94,7 +94,7 @@ do grep "$i " $TEMPDIR/ranges.txt >> $TEMPDIR/ranges.filter || true done cp $TEMPDIR/ranges.filter $TEMPDIR/ranges.txt -REMAINING_FILES=$(wc -l $TEMPDIR/ranges.filter | awk '{print $1}') +REMAINING_FILES=$(wc -l <$TEMPDIR/ranges.filter) if [ $REMAINING_FILES -eq 0 ] then echo "This commit has no files that require checking" @@ -107,7 +107,7 @@ fi # to $TEMPDIR/check-format. This give us the full file to run # check-format.pl on with line numbers matching the ranges in the # $TEMPDIR/ranges.txt file -for j in $(cat $TEMPDIR/ranges.txt | awk '{print $1}' | sort | uniq) +for j in $(awk '{print $1}' $TEMPDIR/ranges.txt | sort -u) do FDIR=$(dirname $j) mkdir -p $TEMPDIR/check-format/$FDIR @@ -115,7 +115,7 @@ do done # Now for each file in $TEMPDIR/ranges.txt, run check-format.pl -for j in $(cat $TEMPDIR/ranges.txt | awk '{print $1}' | sort | uniq) +for j in $(awk '{print $1}' $TEMPDIR/ranges.txt | sort -u) do range_start=() range_end=()