From: Sascha Schumann Date: Sat, 8 May 1999 21:44:12 +0000 (+0000) Subject: this is faster than parsing the file line by line X-Git-Tag: BEFORE_PHP4_APACHE_MODULE_CHANGE~83 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=17a36c37d136580596cddb343336eb4a3f681a39;p=php this is faster than parsing the file line by line --- diff --git a/genif.sh b/genif.sh index 571e2b9a88..c071743b06 100644 --- a/genif.sh +++ b/genif.sh @@ -1,6 +1,6 @@ #! /bin/sh -# $Id: genif.sh,v 1.2 1999-05-08 18:16:29 andrey Exp $ +# $Id: genif.sh,v 1.3 1999-05-08 21:44:12 sas Exp $ # replacement for genif.pl infile="$1" @@ -13,24 +13,24 @@ if test "$infile" = "" -o "$srcdir" = ""; then exit 1 fi -cmd1='echo $data | grep @EXT_INCLUDE_CODE@ > /dev/null 2>&1' -cmd2='echo $data | grep @EXT_MODULE_PTRS@ > /dev/null 2>&1' - -while read data; do - if eval $cmd1 ; then - for ext in $* ; do - for pre in php3 php php4 zend; do - hdrfile="ext/$ext/${pre}_${ext}.h" - if test -f $hdrfile ; then - echo "#include \"$hdrfile\"" - fi - done - done - elif eval $cmd2 ; then - for ext in $* ; do - echo " phpext_${ext}_ptr," - done - else - echo "$data" - fi -done < $infile +module_ptrs="" +includes="" + +# the 'ä' is used as a newline replacement +# its later tr'd to '\n' + +for ext in $* ; do + module_ptrs=" phpext_${ext}_ptr,ä$module_ptrs" + for pre in php3 php php4 zend; do + hdrfile="ext/$ext/${pre}_${ext}.h" + if test -f $hdrfile ; then + includes="#include \"$hdrfile\"ä$includes" + fi + done +done + +cat $infile | \ + sed "s'@EXT_INCLUDE_CODE@'$includes'" | \ + sed "s'@EXT_MODULE_PTRS@'$module_ptrs'" | \ + tr ä '\n' +