loci: replace indirect wire_length_get calls

All objects of the same inheritance tree use the same wire length accessors. We
know what inheritance tree we're working with, so generate a direct call.
diff --git a/c_gen/codegen.py b/c_gen/codegen.py
index fb9ba50..a64a480 100644
--- a/c_gen/codegen.py
+++ b/c_gen/codegen.py
@@ -160,10 +160,9 @@
         cls, e_cls = loxi_utils_legacy.list_name_extract(oftype)
         e_cls = e_cls[:-2]
         e_uclass = loxi_globals.unified.class_by_name(e_cls)
-        has_wire_length = any(isinstance(m, ir.OFLengthMember) for m in e_uclass.members)
         with template_utils.open_output(install_dir, "loci/src/%s.c" % cls) as out:
             util.render_template(out, "list.c", cls=cls, e_cls=e_cls, e_uclass=e_uclass,
-                                 has_wire_length=has_wire_length)
+                                 wire_length_get=class_metadata_dict[e_cls].wire_length_get)
             # Append legacy generated code
             c_code_gen.gen_new_function_definitions(out, cls)
 
diff --git a/c_gen/templates/list.c b/c_gen/templates/list.c
index 95b0276..5ce3e96 100644
--- a/c_gen/templates/list.c
+++ b/c_gen/templates/list.c
@@ -57,8 +57,8 @@
     ${e_cls}_wire_object_id_get(obj, &obj->object_id);
 :: #endif
 
-:: if has_wire_length:
-    loci_class_metadata[obj->object_id].wire_length_get(obj, &obj->length);
+:: if wire_length_get != 'NULL':
+    ${wire_length_get}(obj, &obj->length);
 :: else:
     obj->length = of_object_fixed_len[obj->version][obj->object_id];
 :: #endif
@@ -88,8 +88,8 @@
     ${e_cls}_wire_object_id_get(obj, &obj->object_id);
 :: #endif
 
-:: if has_wire_length:
-    loci_class_metadata[obj->object_id].wire_length_get(obj, &obj->length);
+:: if wire_length_get != 'NULL':
+    ${wire_length_get}(obj, &obj->length);
 :: else:
     obj->length = of_object_fixed_len[obj->version][obj->object_id];
 :: #endif