loci: remove owned field from of_object
This field was redundant with the parent field. Saves 8 bytes per of_object.
diff --git a/c_gen/c_code_gen.py b/c_gen/c_code_gen.py
index feafe95..45eca7f 100644
--- a/c_gen/c_code_gen.py
+++ b/c_gen/c_code_gen.py
@@ -1679,7 +1679,6 @@
%(m_name)s->parent = (of_object_t *)obj;
%(m_name)s->wbuf = obj->wbuf;
%(m_name)s->obj_offset = abs_offset;
- %(m_name)s->owned = 0;
%(m_name)s->length = cur_len;
""" % dict(m_type=m_type[:-2], m_name=m_name))
diff --git a/c_gen/templates/of_object.c b/c_gen/templates/of_object.c
index feb447a..39a6790 100644
--- a/c_gen/templates/of_object.c
+++ b/c_gen/templates/of_object.c
@@ -65,7 +65,6 @@
FREE(obj);
return NULL;
}
- obj->owned = 1;
}
return obj;
@@ -87,7 +86,7 @@
return;
}
- if (obj->owned) {
+ if (obj->parent == NULL) {
of_wire_buffer_free(obj->wbuf);
}
@@ -119,8 +118,6 @@
return NULL;
}
- dst->owned = 1;
-
init_fn = of_object_init_map[src->object_id];
init_fn(dst, src->version, src->length, 0);
@@ -244,7 +241,6 @@
obj->wbuf = wbuf;
obj->obj_offset = 0;
- obj->owned = 1;
obj->length = bytes;
return OF_ERROR_NONE;
@@ -288,7 +284,6 @@
/* Set up the child's wire buf to point to same as parent */
child->wbuf = wbuf;
child->obj_offset = parent->obj_offset + offset;
- child->owned = 0;
/*
* bytes determines if this is a read or write setup.
diff --git a/c_gen/templates/of_object.h b/c_gen/templates/of_object.h
index bce0808..d299537 100644
--- a/c_gen/templates/of_object.h
+++ b/c_gen/templates/of_object.h
@@ -108,9 +108,6 @@
* underlying buffer */
int obj_offset;
- /* Boolean, whether the object owns the wire buffer. */
- char owned;
-
/* The LOCI type enum value of the object */
of_object_id_t object_id;