[2/5] makedef: Fold as much text transformations as possible into the initial dump

Message ID 1503647204-20460-2-git-send-email-martin@martin.st
State Committed
Headers show

Commit Message

Martin Storsjö Aug. 25, 2017, 7:46 a.m.
This avoids redoing them for each expression in the list.
---
 compat/windows/makedef | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Luca Barbato Aug. 25, 2017, 5 p.m. | #1
On 25/08/2017 09:46, Martin Storsjö wrote:
> This avoids redoing them for each expression in the list.
> ---
>   compat/windows/makedef | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/compat/windows/makedef b/compat/windows/makedef
> index fcaf108..b3de992 100755
> --- a/compat/windows/makedef
> +++ b/compat/windows/makedef
> @@ -112,7 +112,10 @@ for line in $(cat ${vscript} | tr '\t' ' '); do
>   '
>   done
>   
> -dump=$(dumpbin -linkermember:1 ${libname})
> +dump=$(dumpbin -linkermember:1 ${libname} |
> +          sed -e '/public symbols/,$!d' -e '/^ \{1,\}Summary/,$d' -e "s/ \{1,\}${prefix}/ /" -e 's/ \{1,\}/ /g' |
> +          tail -n +2 |
> +          cut -d' ' -f3)
>   
>   rm ${libname}
>   
> @@ -121,9 +124,6 @@ list=""
>   for exp in ${regex}; do
>       list="${list}"'
>   '$(echo "${dump}" |
> -          sed -e '/public symbols/,$!d' -e '/^ \{1,\}Summary/,$d' -e "s/ \{1,\}${prefix}/ /" -e 's/ \{1,\}/ /g' |
> -          tail -n +2 |
> -          cut -d' ' -f3 |
>             grep "^${exp}" |
>             sed -e 's/^/    /')
>   done
> 

Ok.

Patch

diff --git a/compat/windows/makedef b/compat/windows/makedef
index fcaf108..b3de992 100755
--- a/compat/windows/makedef
+++ b/compat/windows/makedef
@@ -112,7 +112,10 @@  for line in $(cat ${vscript} | tr '\t' ' '); do
 '
 done
 
-dump=$(dumpbin -linkermember:1 ${libname})
+dump=$(dumpbin -linkermember:1 ${libname} |
+          sed -e '/public symbols/,$!d' -e '/^ \{1,\}Summary/,$d' -e "s/ \{1,\}${prefix}/ /" -e 's/ \{1,\}/ /g' |
+          tail -n +2 |
+          cut -d' ' -f3)
 
 rm ${libname}
 
@@ -121,9 +124,6 @@  list=""
 for exp in ${regex}; do
     list="${list}"'
 '$(echo "${dump}" |
-          sed -e '/public symbols/,$!d' -e '/^ \{1,\}Summary/,$d' -e "s/ \{1,\}${prefix}/ /" -e 's/ \{1,\}/ /g' |
-          tail -n +2 |
-          cut -d' ' -f3 |
           grep "^${exp}" |
           sed -e 's/^/    /')
 done