loci: remove generic union
Not used anywhere important.
diff --git a/c_gen/c_code_gen.py b/c_gen/c_code_gen.py
index d734032..eb2c665 100644
--- a/c_gen/c_code_gen.py
+++ b/c_gen/c_code_gen.py
@@ -1122,33 +1122,6 @@
""")
-def gen_generic_union(out):
- """
- Generate the generic union object composing all LOCI objects
-
- @param out The file to which to write the decs
- """
- out.write("""
-/**
- * The common LOCI object is a union of all possible objects.
- */
-union of_generic_u {
- of_object_t object; /* Common base class with fundamental accessors */
-
- /* Message objects */
-""")
- for cls in of_g.ordered_messages:
- out.write(" %s_t %s;\n" % (cls, cls))
- out.write("\n /* Non-message composite objects */\n")
- for cls in of_g.ordered_non_messages:
- if cls in type_maps.inheritance_map:
- continue
- out.write(" %s_t %s;\n" % (cls, cls))
- out.write("\n /* List objects */\n")
- for cls in of_g.ordered_list_objects:
- out.write(" %s_t %s;\n" % (cls, cls))
- out.write("};\n")
-
def gen_flow_add_setup_function_declarations(out):
"""
Add the declarations for functions that can be initialized
diff --git a/c_gen/codegen.py b/c_gen/codegen.py
index 3f8aaf4..92d0f11 100644
--- a/c_gen/codegen.py
+++ b/c_gen/codegen.py
@@ -101,7 +101,6 @@
c_code_gen.gen_struct_typedefs(tmp)
c_code_gen.gen_new_function_declarations(tmp)
c_code_gen.gen_accessor_declarations(tmp)
- c_code_gen.gen_generic_union(tmp)
c_code_gen.gen_generics(tmp)
with template_utils.open_output(install_dir, "loci/inc/loci/loci_classes.h") as out:
diff --git a/c_gen/templates/of_object.c b/c_gen/templates/of_object.c
index cf19e20..5523cfc 100644
--- a/c_gen/templates/of_object.c
+++ b/c_gen/templates/of_object.c
@@ -55,10 +55,10 @@
{
of_object_t *obj;
- if ((obj = (of_object_t *)MALLOC(sizeof(of_generic_t))) == NULL) {
+ if ((obj = (of_object_t *)MALLOC(sizeof(*obj))) == NULL) {
return NULL;
}
- MEMSET(obj, 0, sizeof(of_generic_t));
+ MEMSET(obj, 0, sizeof(*obj));
if (bytes > 0) {
if ((obj->wire_object.wbuf = of_wire_buffer_new(bytes)) == NULL) {
@@ -114,7 +114,7 @@
of_object_t *dst;
of_object_init_f init_fn;
- if ((dst = (of_object_t *)MALLOC(sizeof(of_generic_t))) == NULL) {
+ if ((dst = (of_object_t *)MALLOC(sizeof(*dst))) == NULL) {
return NULL;
}