diff options
author | Роман Донченко <dpb@corrigendum.ru> | 2014-06-27 22:10:28 +0400 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2014-07-06 08:08:20 +0000 |
commit | afa8f21f56f1e65bb2ec37cffdf3422d15b45347 (patch) | |
tree | bbb9b85dfdcc347cc44ce681e724ea80eb857923 | |
parent | 3490bc6eb923e7e8666f9ad9213b0f5010a91c03 (diff) | |
download | wireshark-afa8f21f56f1e65bb2ec37cffdf3422d15b45347.tar.gz |
make-dissectors-reg: optimize by factoring out the loops
Instead of calling the grep/sed pipelines for each file, build the
list of files in the beginning and call each pipeline only once,
passing the list to the first grep.
This results in a massive speedup in Cygwin; in my test, the time
it takes to run make-dissector-reg . dissectors packet-*.c in dissectors/epan
is reduced from ~116 to ~3 seconds. I also tried it on NetBSD, where
the time do to the same goes from ~6 to ~0.5 seconds.
Amend makefile comments to elide mentions of invoking multiple processes
per file.
Change-Id: Iad441e7d2b6cc3669dada57646e2f8f6b987fd34
Reviewed-on: https://code.wireshark.org/review/2826
Reviewed-by: Anders Broman <a.broman58@gmail.com>
29 files changed, 176 insertions, 220 deletions
diff --git a/epan/dissectors/Makefile.am b/epan/dissectors/Makefile.am index 80a066c078..b48d3edd52 100644 --- a/epan/dissectors/Makefile.am +++ b/epan/dissectors/Makefile.am @@ -86,11 +86,11 @@ x11-dissector: $(top_srcdir)/tools/process-x11-fields.pl x11-fields $(top_srcdir # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the register.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "dissectors", to indicate that we should build diff --git a/epan/dissectors/Makefile.nmake b/epan/dissectors/Makefile.nmake index 0af94105ca..35edf09baf 100644 --- a/epan/dissectors/Makefile.nmake +++ b/epan/dissectors/Makefile.nmake @@ -65,11 +65,11 @@ packet-rrc.obj : packet-rrc.c # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the register.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "dissectors", to indicate that we should build diff --git a/plugins/asn1/Makefile.am b/plugins/asn1/Makefile.am index 405d9e47e7..f7d4401fc1 100644 --- a/plugins/asn1/Makefile.am +++ b/plugins/asn1/Makefile.am @@ -70,11 +70,11 @@ LIBS = # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/asn1/Makefile.nmake b/plugins/asn1/Makefile.nmake index 678ddb88bf..6b8cf60419 100644 --- a/plugins/asn1/Makefile.nmake +++ b/plugins/asn1/Makefile.nmake @@ -64,11 +64,11 @@ $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLU # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/docsis/Makefile.am b/plugins/docsis/Makefile.am index bc53f5d911..bc2d65cc97 100644 --- a/plugins/docsis/Makefile.am +++ b/plugins/docsis/Makefile.am @@ -70,11 +70,11 @@ LIBS = # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/docsis/Makefile.nmake b/plugins/docsis/Makefile.nmake index 93331e7e1d..29088bdc55 100644 --- a/plugins/docsis/Makefile.nmake +++ b/plugins/docsis/Makefile.nmake @@ -64,11 +64,11 @@ $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLU # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/ethercat/Makefile.am b/plugins/ethercat/Makefile.am index 7a602a88cf..2cfe58d70b 100644 --- a/plugins/ethercat/Makefile.am +++ b/plugins/ethercat/Makefile.am @@ -70,11 +70,11 @@ LIBS = # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/ethercat/Makefile.nmake b/plugins/ethercat/Makefile.nmake index fa4542afb9..efcb7da2d1 100644 --- a/plugins/ethercat/Makefile.nmake +++ b/plugins/ethercat/Makefile.nmake @@ -64,11 +64,11 @@ $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLU # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/gryphon/Makefile.am b/plugins/gryphon/Makefile.am index 1593e28392..67cd086582 100644 --- a/plugins/gryphon/Makefile.am +++ b/plugins/gryphon/Makefile.am @@ -72,11 +72,11 @@ LIBS = # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/gryphon/Makefile.nmake b/plugins/gryphon/Makefile.nmake index a652e83f55..b5bc9ec6df 100644 --- a/plugins/gryphon/Makefile.nmake +++ b/plugins/gryphon/Makefile.nmake @@ -64,11 +64,11 @@ $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLU # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/irda/Makefile.am b/plugins/irda/Makefile.am index f83062f2d8..5af7e9cf2a 100644 --- a/plugins/irda/Makefile.am +++ b/plugins/irda/Makefile.am @@ -70,11 +70,11 @@ LIBS = # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/irda/Makefile.nmake b/plugins/irda/Makefile.nmake index 79c2b8f62e..d13b42a3c3 100644 --- a/plugins/irda/Makefile.nmake +++ b/plugins/irda/Makefile.nmake @@ -64,11 +64,11 @@ $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLU # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/m2m/Makefile.am b/plugins/m2m/Makefile.am index 6ba2b773cb..15b665e1ff 100644 --- a/plugins/m2m/Makefile.am +++ b/plugins/m2m/Makefile.am @@ -70,11 +70,11 @@ LIBS = # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/m2m/Makefile.nmake b/plugins/m2m/Makefile.nmake index 9e06f165a1..b566f98062 100644 --- a/plugins/m2m/Makefile.nmake +++ b/plugins/m2m/Makefile.nmake @@ -64,11 +64,11 @@ $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLU # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/mate/Makefile.am b/plugins/mate/Makefile.am index 64679ff9e9..f3a2b7b05c 100644 --- a/plugins/mate/Makefile.am +++ b/plugins/mate/Makefile.am @@ -77,11 +77,11 @@ LIBS = # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/mate/Makefile.nmake b/plugins/mate/Makefile.nmake index 48fcaf39f7..7d301d9694 100644 --- a/plugins/mate/Makefile.nmake +++ b/plugins/mate/Makefile.nmake @@ -70,11 +70,11 @@ $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLU # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/opcua/Makefile.am b/plugins/opcua/Makefile.am index 43f33fd4ea..4c32a3eccd 100644 --- a/plugins/opcua/Makefile.am +++ b/plugins/opcua/Makefile.am @@ -71,11 +71,11 @@ LIBS = # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/opcua/Makefile.nmake b/plugins/opcua/Makefile.nmake index 3e0d49825a..ce27752704 100644 --- a/plugins/opcua/Makefile.nmake +++ b/plugins/opcua/Makefile.nmake @@ -64,11 +64,11 @@ $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLU # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/profinet/Makefile.am b/plugins/profinet/Makefile.am index bbe106f61b..719ed9cf8c 100644 --- a/plugins/profinet/Makefile.am +++ b/plugins/profinet/Makefile.am @@ -70,11 +70,11 @@ LIBS = # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/profinet/Makefile.nmake b/plugins/profinet/Makefile.nmake index b4ad8cb15a..d431fcc680 100644 --- a/plugins/profinet/Makefile.nmake +++ b/plugins/profinet/Makefile.nmake @@ -64,11 +64,11 @@ $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLU # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/unistim/Makefile.am b/plugins/unistim/Makefile.am index df6d1d1f47..929ca44251 100644 --- a/plugins/unistim/Makefile.am +++ b/plugins/unistim/Makefile.am @@ -71,11 +71,11 @@ LIBS = # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/unistim/Makefile.nmake b/plugins/unistim/Makefile.nmake index 412850997c..5451ec04ce 100644 --- a/plugins/unistim/Makefile.nmake +++ b/plugins/unistim/Makefile.nmake @@ -64,11 +64,11 @@ $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLU # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/wimax/Makefile.am b/plugins/wimax/Makefile.am index c6ee98c72b..f9b617d5c6 100644 --- a/plugins/wimax/Makefile.am +++ b/plugins/wimax/Makefile.am @@ -70,11 +70,11 @@ LIBS = # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/wimax/Makefile.nmake b/plugins/wimax/Makefile.nmake index 52c4ea0604..981cf8f1d1 100644 --- a/plugins/wimax/Makefile.nmake +++ b/plugins/wimax/Makefile.nmake @@ -64,11 +64,11 @@ $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLU # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/wimaxasncp/Makefile.am b/plugins/wimaxasncp/Makefile.am index 1da4282bdc..49fad9d261 100644 --- a/plugins/wimaxasncp/Makefile.am +++ b/plugins/wimaxasncp/Makefile.am @@ -73,11 +73,11 @@ LIBS = # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/wimaxasncp/Makefile.nmake b/plugins/wimaxasncp/Makefile.nmake index 163773ac23..8fe22f3b00 100644 --- a/plugins/wimaxasncp/Makefile.nmake +++ b/plugins/wimaxasncp/Makefile.nmake @@ -68,11 +68,11 @@ $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLU # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/wimaxmacphy/Makefile.am b/plugins/wimaxmacphy/Makefile.am index 17957b1d16..a78814bb0c 100644 --- a/plugins/wimaxmacphy/Makefile.am +++ b/plugins/wimaxmacphy/Makefile.am @@ -70,11 +70,11 @@ LIBS = # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/plugins/wimaxmacphy/Makefile.nmake b/plugins/wimaxmacphy/Makefile.nmake index 860a21a7b3..0b4139a4ce 100644 --- a/plugins/wimaxmacphy/Makefile.nmake +++ b/plugins/wimaxmacphy/Makefile.nmake @@ -64,11 +64,11 @@ $(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLU # pass only the first few names in the list to the shell, for some # reason. # -# Therefore, we have a script to generate the plugin.c file. -# The shell script runs slowly, as multiple greps and seds are run -# for each input file; this is especially slow on Windows. Therefore, -# if Python is present (as indicated by PYTHON being defined), we run -# a faster Python script to do that work instead. +# Therefore, we use a script to generate the register.c file. +# There are two versions of the script, a shell and a Python version. +# The Python script runs faster, since it uses caching to speed up +# repeated runs and doesn't invoke external processes, so we prefer +# that if Python is available. # # The first argument is the directory in which the source files live. # The second argument is "plugin", to indicate that we should build diff --git a/tools/make-dissector-reg b/tools/make-dissector-reg index d28793e1d5..72e896d0b2 100755 --- a/tools/make-dissector-reg +++ b/tools/make-dissector-reg @@ -27,6 +27,22 @@ fi # # All subsequent arguments are the files to scan. # +files='' + +for f in "$@" +do + # This won't work if any filenames contain spaces. + # However, this script is called by make, which doesn't support + # spaces either. + if [ -f "$f" ] + then + files="$files $f" + else + files="$files $srcdir/$f" + fi +done + + rm -f ${outfile}-tmp echo '/* Do not modify this file. */' >${outfile}-tmp echo '/* It is created automatically by the Makefile. */'>>${outfile}-tmp @@ -54,26 +70,11 @@ EOF # # Build code to call all the protocol registration routines. # - for f in "$@" - do - if [ -f $f ] - then - srcfile=$f - else - srcfile=$srcdir/$f - fi - grep '^proto_register_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';' - done | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp - for f in "$@" - do - if [ -f $f ] - then - srcfile=$f - else - srcfile=$srcdir/$f - fi - grep '^void proto_register_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';' - done | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp + grep '^proto_register_[a-z_0-9A-Z]* *(' $files 2>/dev/null | grep -v ';' \ + | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp + + grep '^void proto_register_[a-z_0-9A-Z]* *(' $files 2>/dev/null | grep -v ';' \ + | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp else cat <<"EOF" >>${outfile}-tmp #include "register.h" @@ -84,26 +85,11 @@ EOF # # Build code to call all the protocol registration routines. # - for f in "$@" - do - if [ -f $f ] - then - srcfile=$f - else - srcfile=$srcdir/$f - fi - grep '^proto_register_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';' - done | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); if(cb) (*cb)(RA_REGISTER, \"\1\", client_data); \1 ();}/' >>${outfile}-tmp - for f in "$@" - do - if [ -f $f ] - then - srcfile=$f - else - srcfile=$srcdir/$f - fi - grep '^void proto_register_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';' - done | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); if(cb) (*cb)(RA_REGISTER, \"\1\", client_data); \1 ();}/' >>${outfile}-tmp + grep '^proto_register_[a-z_0-9A-Z]* *(' $files 2>/dev/null | grep -v ';' \ + | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); if(cb) (*cb)(RA_REGISTER, \"\1\", client_data); \1 ();}/' >>${outfile}-tmp + + grep '^void proto_register_[a-z_0-9A-Z]* *(' $files 2>/dev/null | grep -v ';' \ + | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); if(cb) (*cb)(RA_REGISTER, \"\1\", client_data); \1 ();}/' >>${outfile}-tmp fi echo '}' >>${outfile}-tmp @@ -119,52 +105,22 @@ WS_DLL_PUBLIC_DEF void plugin_reg_handoff(void) { EOF - for f in "$@" - do - if [ -f $f ] - then - srcfile=$f - else - srcfile=$srcdir/$f - fi - grep '^proto_reg_handoff_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';' - done | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp - for f in "$@" - do - if [ -f $f ] - then - srcfile=$f - else - srcfile=$srcdir/$f - fi - grep '^void proto_reg_handoff_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';' - done | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp + grep '^proto_reg_handoff_[a-z_0-9A-Z]* *(' $files 2>/dev/null | grep -v ';' \ + | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp + + grep '^void proto_reg_handoff_[a-z_0-9A-Z]* *(' $files 2>/dev/null | grep -v ';' \ + | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp else cat <<"EOF" >>${outfile}-tmp void register_all_protocol_handoffs(register_cb cb, gpointer client_data) { EOF - for f in "$@" - do - if [ -f $f ] - then - srcfile=$f - else - srcfile=$srcdir/$f - fi - grep '^proto_reg_handoff_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';' - done | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); if(cb) (*cb)(RA_HANDOFF, \"\1\", client_data); \1 ();}/' >>${outfile}-tmp - for f in "$@" - do - if [ -f $f ] - then - srcfile=$f - else - srcfile=$srcdir/$f - fi - grep '^void proto_reg_handoff_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';' - done | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); if(cb) (*cb)(RA_HANDOFF, \"\1\", client_data); \1 ();}/' >>${outfile}-tmp + grep '^proto_reg_handoff_[a-z_0-9A-Z]* *(' $files 2>/dev/null | grep -v ';' \ + | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); if(cb) (*cb)(RA_HANDOFF, \"\1\", client_data); \1 ();}/' >>${outfile}-tmp + + grep '^void proto_reg_handoff_[a-z_0-9A-Z]* *(' $files 2>/dev/null | grep -v ';' \ + | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); if(cb) (*cb)(RA_HANDOFF, \"\1\", client_data); \1 ();}/' >>${outfile}-tmp fi echo '}' >>${outfile}-tmp if [ "$registertype" = plugin ] |