@@ -637,7 +637,17 @@ Object *object_new_with_class(ObjectClass *klass, Error **errp);
*
* Returns: The newly allocated and instantiated object.
*/
-Object *object_new(const char *typename);
+
+/*
+ * NB, object_new_internal is just an internal helper, wrapped by
+ * the object_new() macro which prevents invokation unless given
+ * a static, const string.
+ *
+ * Code should call object_new(), or object_new_dynamic(), not
+ * object_new_internal().
+ */
+Object *object_new_internal(const char *typename);
+#define object_new(typename) object_new_internal(typename "")
/**
* object_new_dynamic:
@@ -799,7 +799,8 @@ Object *object_new_with_class(ObjectClass *klass, Error **errp)
return object_new_with_type(klass->type, errp);
}
-Object *object_new(const char *typename)
+/* Only to be called via the 'object_new' macro */
+Object *object_new_internal(const char *typename)
{
TypeImpl *ti = type_get_or_load_by_name(typename, &error_fatal);