[Spice-devel] [PATCH] codegen: drop config.h and use short license header for Wireshark

Peter Wu peter at lekensteyn.nl
Fri Aug 31 23:43:11 UTC 2018


Shorten the generated dissector, drop unused config.h inclusion and
abbreviate the license blurb. No functional change, cosmetics only.

Signed-off-by: Peter Wu <peter at lekensteyn.nl>
---
For the updated output, see https://code.wireshark.org/review/29380
I considered capitalizing names such as SPICE_VSC_MESSAGE_TYPE_FLUSHCOMPLETE
(instead of SPICE_VSC_MESSAGE_TYPE_FlushComplete), but that breaks the public
spice-protocol interface which has been there since at least 2010, so nope.
---
 spice_codegen.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/spice_codegen.py b/spice_codegen.py
index 76d7c5e..d791064 100755
--- a/spice_codegen.py
+++ b/spice_codegen.py
@@ -176,7 +176,15 @@ writer.header.set_option("dest_file", dest_file)
 writer.set_option("source", os.path.basename(proto_file))
 
 if options.license == "LGPL":
-    license = """/*
+    if options.generate_dissector:
+        license = """/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+"""
+    else:
+        license = """/*
   Copyright (C) 2013 Red Hat, Inc.
 
   This library is free software; you can redistribute it and/or
@@ -236,7 +244,7 @@ writer.writeln("/* this is a file autogenerated by spice_codegen.py */")
 writer.write(license)
 writer.header.writeln("/* this is a file autogenerated by spice_codegen.py */")
 writer.header.write(license)
-if not options.header and not options.generate_enums:
+if not (options.header or options.generate_enums or options.generate_dissector):
     writer.writeln("#ifdef HAVE_CONFIG_H")
     writer.writeln("#include <config.h>")
     writer.writeln("#endif")
-- 
2.18.0



More information about the Spice-devel mailing list