From f2988f2bea65e345fd58e0e413b9eef4359d196b Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Mon, 6 Jun 2011 20:04:59 -0400 Subject: functions: simplify parse_hook Since we intentionally word split these variables, a variable containing only white space will never trigger us to iterate on each for loop. Therefore, the existance check is superfluous as it will always pass. Signed-off-by: Dave Reisner --- functions | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/functions b/functions index 17c15b5..bd80eb2 100644 --- a/functions +++ b/functions @@ -262,28 +262,21 @@ parse_hook() { # prior to the start of hook processing, and after each hook's build # function is run. - local mod bin fil - for mod in ${MODULES}; do - if [ -n "${mod}" ]; then - add_module "${mod}" - fi + local item + + for item in $MODULES; do + add_module "$item" done - for bin in ${BINARIES}; do - if [ -n "${bin}" ]; then - add_binary "${bin}" - fi + for item in $BINARIES; do + add_binary "$item" done - for fil in ${FILES}; do - if [ -n "${fil}" ]; then - add_file "${fil}" - fi + for item in $FILES; do + add_file "$item" done - if [ -n "${SCRIPT}" ]; then - add_file "${HOOKDIR}/${SCRIPT}" "/hooks/${SCRIPT}" - fi + [[ $SCRIPT ]] && add_file "$HOOKDIR/$SCRIPT" "/hooks/$SCRIPT" } # vim: set ft=sh ts=4 sw=4 et: -- cgit v1.2.3-24-g4f1b