loci: move of_object_parent_length_update to of_object.c
This function did not need to be inlined.
diff --git a/c_gen/c_code_gen.py b/c_gen/c_code_gen.py
index 5cfba39..993bc1c 100644
--- a/c_gen/c_code_gen.py
+++ b/c_gen/c_code_gen.py
@@ -433,7 +433,6 @@
gen_flow_add_setup_function_declarations(out)
if config_check("gen_fn_ptrs"): # Otherwise, all classes are from generic cls
gen_struct_definitions(out)
- gen_top_static_functions(out)
out.write("""
/****************************************************************
*
@@ -800,51 +799,6 @@
****************************************************************/
""")
-def gen_top_static_functions(out):
- out.write("""
-
-#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.
- */
-static inline 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;
- }
-}
-""")
-
################################################################
#
################################################################
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
diff --git a/c_gen/templates/of_object.h b/c_gen/templates/of_object.h
index fee95e1..a85e33e 100644
--- a/c_gen/templates/of_object.h
+++ b/c_gen/templates/of_object.h
@@ -192,6 +192,8 @@
int of_object_can_grow(of_object_t *obj, int new_len);
+void of_object_parent_length_update(of_object_t *obj, int delta);
+
struct of_object_s {
/* The control block for the underlying data buffer */
of_wire_object_t wire_object;