loci: move of_object_parent_length_update to of_object.c
This function did not need to be inlined.
diff --git a/c_gen/templates/of_object.c b/c_gen/templates/of_object.c
index ae22f64..a328b3e 100644
--- a/c_gen/templates/of_object.c
+++ b/c_gen/templates/of_object.c
@@ -641,6 +641,47 @@
obj->wire_object.wbuf = NULL;
}
+#define _MAX_PARENT_ITERATIONS 4
+/**
+ * Iteratively update parent lengths thru hierarchy
+ * @param obj The object whose length is being updated
+ * @param delta The difference between the current and new lengths
+ *
+ * Note that this includes updating the object itself. It will
+ * iterate thru parents.
+ *
+ * Assumes delta > 0.
+ */
+void
+of_object_parent_length_update(of_object_t *obj, int delta)
+{
+#ifndef NDEBUG
+ int count = 0;
+ of_wire_buffer_t *wbuf; /* For debug asserts only */
+#endif
+
+ while (obj != NULL) {
+ ASSERT(count++ < _MAX_PARENT_ITERATIONS);
+ obj->length += delta;
+ if (obj->wire_length_set != NULL) {
+ obj->wire_length_set(obj, obj->length);
+ }
+#ifndef NDEBUG
+ wbuf = obj->wire_object.wbuf;
+#endif
+
+ /* Asserts for wire length checking */
+ ASSERT(obj->length + obj->wire_object.obj_offset <=
+ WBUF_CURRENT_BYTES(wbuf));
+ if (obj->parent == NULL) {
+ ASSERT(obj->length + obj->wire_object.obj_offset ==
+ WBUF_CURRENT_BYTES(wbuf));
+ }
+
+ obj = obj->parent;
+ }
+}
+
/*
* Set member:
* get_wbuf_extent