Ethereal-dev: [Ethereal-dev] fixing the build

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Stefan (metze) Metzmacher" <metze@xxxxxxxxx>
Date: Tue, 18 Apr 2006 17:35:19 +0200
Hi,

can someone apply this patch,

the problem is that register_all_protocols() exists twice,
but the the internal one is called twice, and registering
the same protocol twice isn't allowed...

thanks!

metze

=== epan/dissectors/Makefile.am
==================================================================
--- epan/dissectors/Makefile.am	(revision 2196)
+++ epan/dissectors/Makefile.am	(local)
@@ -79,10 +79,11 @@
     $(top_srcdir)/tools/make-reg-dotc.py
 	@if test -n $(PYTHON); then \
 		echo Making register.c with python ; \
-		$(PYTHON) $(top_srcdir)/tools/make-reg-dotc.py $(srcdir) $(DISSECTOR_SRC) ; \
+		$(PYTHON) $(top_srcdir)/tools/make-reg-dotc.py $(srcdir) "all" \
+			$(plugin_src) $(DISSECTOR_SRC) ; \
 	else \
 		echo Making register.c with shell script ; \
-		$(top_srcdir)/tools/make-reg-dotc register.c $(srcdir) \
+		$(SHELL) $(top_srcdir)/tools/make-reg-dotc register.c $(srcdir) "all" \
 			$(plugin_src) $(DISSECTOR_SRC) ; \
 	fi
 
=== epan/dissectors/Makefile.nmake
==================================================================
--- epan/dissectors/Makefile.nmake	(revision 2196)
+++ epan/dissectors/Makefile.nmake	(local)
@@ -74,10 +74,10 @@
 register.c: $(DISSECTOR_SRC)
 !IFDEF PYTHON
 	@echo Making register.c (using python)
-	@$(PYTHON) ../../tools/make-reg-dotc.py . $(DISSECTOR_SRC)
+	@$(PYTHON) ../../tools/make-reg-dotc.py . "all" $(DISSECTOR_SRC)
 !ELSE
 	@echo Making register.c (using sh)
-	@$(SH) ../../tools/make-reg-dotc register.c . $(DISSECTOR_SRC)
+	@$(SH) ../../tools/make-reg-dotc register.c . "all" $(DISSECTOR_SRC)
 !ENDIF
 
 packet-ncp2222.c : ncp2222.py
=== plugins/docsis/Makefile.am
==================================================================
--- plugins/docsis/Makefile.am	(revision 2196)
+++ plugins/docsis/Makefile.am	(local)
@@ -71,11 +71,10 @@
     $(top_srcdir)/tools/make-reg-dotc.py
 	@if test -n $(PYTHON); then \
 		echo Making register.c with python ; \
-		$(PYTHON) $(top_srcdir)/tools/make-reg-dotc.py $(srcdir) $(DISSECTOR_SRC) ; \
+		$(PYTHON) $(top_srcdir)/tools/make-reg-dotc.py $(srcdir) "docsis" $(DISSECTOR_SRC) ; \
 	else \
 		echo Making register.c with shell script ; \
-		$(top_srcdir)/tools/make-reg-dotc register.c $(srcdir) \
-			$(plugin_src) $(DISSECTOR_SRC) ; \
+		$(SHELL) $(top_srcdir)/tools/make-reg-dotc register.c $(srcdir) "docsis" $(DISSECTOR_SRC) ; \
 	fi
 
 #
=== plugins/docsis/Makefile.nmake
==================================================================
--- plugins/docsis/Makefile.nmake	(revision 2196)
+++ plugins/docsis/Makefile.nmake	(local)
@@ -62,10 +62,10 @@
 register.c: $(DISSECTOR_SRC)
 !IFDEF PYTHON
 	@echo Making register.c (using python)
-	@$(PYTHON) ../../tools/make-reg-dotc.py . $(DISSECTOR_SRC)
+	@$(PYTHON) ../../tools/make-reg-dotc.py . "docsis" $(DISSECTOR_SRC)
 !ELSE
 	@echo Making register.c (using sh)
-	@$(SH) ../../tools/make-reg-dotc register.c . $(DISSECTOR_SRC)
+	@$(SH) ../../tools/make-reg-dotc register.c . "docsis" $(DISSECTOR_SRC)
 !ENDIF
 
 !ENDIF
=== plugins/docsis/plugin.c
==================================================================
--- plugins/docsis/plugin.c	(revision 2196)
+++ plugins/docsis/plugin.c	(local)
@@ -45,7 +45,7 @@
 
   /* register the new protocol, protocol fields, and subtrees */
   if (!registered) {
-    register_all_protocols();
+    register_docsis_protocols();
     registered = TRUE;
   }
 }
@@ -53,7 +53,7 @@
 G_MODULE_EXPORT void
 plugin_reg_handoff (void)
 {
-  register_all_protocol_handoffs();
+  register_docsis_protocol_handoffs();
 }
 
 #endif
=== tools/make-reg-dotc
==================================================================
--- tools/make-reg-dotc	(revision 2196)
+++ tools/make-reg-dotc	(local)
@@ -18,6 +18,14 @@
 shift
 
 #
+# The third argument is the section name
+# we generate e.g.
+#    register_<section>_protocols
+#
+section="$1"
+shift
+
+#
 # All subsequent arguments are the files to scan.
 #
 rm -f ${outfile}-tmp
@@ -28,7 +36,7 @@
 #
 # Build code to call all the protocol registration routines.
 #
-echo 'void register_all_protocols(void) {' >>${outfile}-tmp
+echo "void register_${section}_protocols(void) {" >>${outfile}-tmp
 for f in "$@"
 do
 	if [ -f $f ]
@@ -54,7 +62,7 @@
 #
 # Build code to call all the protocol handoff registration routines.
 #
-echo 'void register_all_protocol_handoffs(void) {' >>${outfile}-tmp
+echo "void register_${section}_protocol_handoffs(void) {" >>${outfile}-tmp
 for f in "$@"
 do
 	if [ -f $f ]
=== tools/make-reg-dotc.py
==================================================================
--- tools/make-reg-dotc.py	(revision 2196)
+++ tools/make-reg-dotc.py	(local)
@@ -24,9 +24,16 @@
 srcdir = sys.argv[1]
 
 #
+# The second argument is the section name
+# we generate e.g.
+#    register_<section>_protocols
+#
+section = sys.argv[2]
+
+#
 # All subsequent arguments are the files to scan.
 #
-files = sys.argv[2:]
+files = sys.argv[3:]
 
 reg_code = open(tmp_filename, "w")
 
@@ -84,7 +91,8 @@
 handoff_reg.sort()
 
 # Make register_all_protocols()
-reg_code.write("void register_all_protocols(void) {\n")
+line = "void register_%s_protocols(void) {\n" % (section)
+reg_code.write(line)
 
 for symbol in proto_reg:
 	line = "  {extern void %s (void); %s ();}\n" % (symbol, symbol)
@@ -94,7 +102,8 @@
 
 
 # Make register_all_protocol_handoffs()
-reg_code.write("void register_all_protocol_handoffs(void) {\n")
+line = "void register_%s_protocol_handoffs(void) {\n" % (section)
+reg_code.write(line)
 
 for symbol in handoff_reg:
 	line = "  {extern void %s (void); %s ();}\n" % (symbol, symbol)
@@ -114,5 +123,3 @@
 
 # Move from tmp file to final file
 os.rename(tmp_filename, final_filename)
-
-

Attachment: signature.asc
Description: OpenPGP digital signature