loci: remove *_new_from_message

These functions were never used. How would you know what type of message it was
without parsing it first? The test is changed to use
of_object_new_from_message, which is what actual clients use.
diff --git a/c_gen/c_code_gen.py b/c_gen/c_code_gen.py
index e4e2403..ba232fd 100644
--- a/c_gen/c_code_gen.py
+++ b/c_gen/c_code_gen.py
@@ -1951,9 +1951,6 @@
  * Initializes the new object with it's default fixed length associating
  * a new underlying wire buffer.
  *
- * Use new_from_message to bind an existing message to a message object,
- * or a _get function for non-message objects.
- *
  * \\ingroup %(cls)s
  */
 
@@ -1995,55 +1992,6 @@
 """ % dict(cls=cls))
 
 
-def gen_from_message_fn_body(cls, out):
-    """
-    Generate function body for from_message function
-    @param cls The class name for the function
-    @param out The file to which to write
-    """
-    out.write("""
-/**
- * Create a new %(cls)s object and bind it to an existing message
- *
- * @param msg The message to bind the new object to
- * @return Pointer to the newly create object or NULL on error
- *
- * \ingroup %(cls)s
- */
-
-%(cls)s_t *
-%(cls)s_new_from_message(of_message_t msg)
-{
-    %(cls)s_t *obj = NULL;
-    of_version_t version;
-    int length;
-
-    if (msg == NULL) return NULL;
-
-    version = of_message_version_get(msg);
-    if (!OF_VERSION_OKAY(version)) return NULL;
-
-    length = of_message_length_get(msg);
-
-    if ((obj = (%(cls)s_t *)of_object_new(-1)) == NULL) {
-        return NULL;
-    }
-
-    %(cls)s_init(obj, version, 0, 0);
-
-    if ((of_object_buffer_bind((of_object_t *)obj, OF_MESSAGE_TO_BUFFER(msg),
-                               length, OF_MESSAGE_FREE_FUNCTION)) < 0) {
-       FREE(obj);
-       return NULL;
-    }
-    obj->length = length;
-    obj->version = version;
-
-    return obj;
-}
-""" % dict(cls=cls))
-
-
 ################################################################
 # Now the top level generator functions
 ################################################################
@@ -2060,13 +2008,10 @@
  * New operator declarations
  *
  * _new: Create a new object for writing; includes init
- * _new_from_message: Create a new instance of the object and bind the
- *    message data to the object
  * _init: Initialize and optionally allocate buffer space for an
  *    automatic instance
  *
- * _new and _from_message require a delete operation to be called
- * on the object.
+ * _new and requires a delete operation to be called on the object.
  *
  ****************************************************************/
 """)
@@ -2076,10 +2021,6 @@
 extern %(cls)s_t *
     %(cls)s_new(of_version_t version);
 """ % dict(cls=cls))
-        if loxi_utils.class_is_message(cls):
-            out.write("""extern %(cls)s_t *
-    %(cls)s_new_from_message(of_message_t msg);
-""" % dict(cls=cls))
         out.write("""extern void %(cls)s_init(
     %(cls)s_t *obj, of_version_t version, int bytes, int clean_wire);
 """ % dict(cls=cls))
@@ -2132,8 +2073,6 @@
 
     gen_new_fn_body(cls, out)
     gen_init_fn_body(cls, out)
-    if loxi_utils.class_is_message(cls):
-        gen_from_message_fn_body(cls, out)
 
 """
 Document generation functions
diff --git a/c_gen/c_test_gen.py b/c_gen/c_test_gen.py
index aff1ca6..5d67bbd 100644
--- a/c_gen/c_test_gen.py
+++ b/c_gen/c_test_gen.py
@@ -1084,6 +1084,7 @@
     uint8_t *msg_buf;
     int value;
     of_object_id_t object_id;
+    int len;
 
     obj = %(cls)s_new(%(v_name)s);
     TEST_ASSERT(obj != NULL);
@@ -1099,11 +1100,13 @@
     value = %(cls)s_%(v_name)s_populate_scalars(obj, 1);
     TEST_ASSERT(value != 0);
 
+    len = obj->length;
+
     /* Grab the underlying buffer from the message */
     of_object_wire_buffer_steal((of_object_t *)obj, &msg_buf);
     TEST_ASSERT(msg_buf != NULL);
     %(cls)s_delete(obj);
-    obj = %(cls)s_new_from_message(OF_BUFFER_TO_MESSAGE(msg_buf));
+    obj = of_object_new_from_message(OF_BUFFER_TO_MESSAGE(msg_buf), len);
 
     TEST_ASSERT(obj != NULL);