loci: factor out of_object_attach

This code was duplicated by bind and list operations, and will be used for
match deserialization..
diff --git a/c_gen/c_code_gen.py b/c_gen/c_code_gen.py
index ba232fd..3c25807 100644
--- a/c_gen/c_code_gen.py
+++ b/c_gen/c_code_gen.py
@@ -1462,10 +1462,7 @@
     /* Initialize child */
     %(m_type)s_init(%(m_name)s, obj->version, 0, 1);
     /* Attach to parent */
-    %(m_name)s->parent = (of_object_t *)obj;
-    %(m_name)s->wbuf = obj->wbuf;
-    %(m_name)s->obj_offset = abs_offset;
-    %(m_name)s->length = cur_len;
+    of_object_attach(obj, %(m_name)s, offset, cur_len);
     of_object_wire_init(%(m_name)s, OF_OXM, 0);
 """ % dict(m_type=m_type[:-2], m_name=m_name))
     elif m_type == "of_bsn_vport_header_t":
@@ -1473,10 +1470,7 @@
     /* Initialize child */
     %(m_type)s_init(%(m_name)s, obj->version, 0, 1);
     /* Attach to parent */
-    %(m_name)s->parent = (of_object_t *)obj;
-    %(m_name)s->wbuf = obj->wbuf;
-    %(m_name)s->obj_offset = abs_offset;
-    %(m_name)s->length = cur_len;
+    of_object_attach(obj, %(m_name)s, offset, cur_len);
     of_object_wire_init(%(m_name)s, OF_BSN_VPORT, 0);
 """ % dict(m_type=m_type[:-2], m_name=m_name))
     else:
@@ -1484,10 +1478,7 @@
     /* Initialize child */
     %(m_type)s_init(%(m_name)s, obj->version, 0, 1);
     /* Attach to parent */
-    %(m_name)s->parent = (of_object_t *)obj;
-    %(m_name)s->wbuf = obj->wbuf;
-    %(m_name)s->obj_offset = abs_offset;
-    %(m_name)s->length = cur_len;
+    of_object_attach(obj, %(m_name)s, offset, cur_len);
 """ % dict(m_type=m_type[:-2], m_name=m_name))