Use new atomis with allocated_heap.
[mono.git] / mono / metadata / mono-mlist.c
index 0b8389e731a8534400145e394d376956320b93b7..a7543b50f851ec194734d38cd5c576bf9ad65d40 100644 (file)
@@ -4,14 +4,14 @@
  * Author:
  *   Paolo Molaro (lupus@ximian.com)
  *
- * (C) 2006 Novell, Inc.
+ * Copyright 2006-2009 Novell, Inc (http://www.novell.com)
  */
 
 #include "mono/metadata/mono-mlist.h"
 #include "mono/metadata/appdomain.h"
 #include "mono/metadata/class-internals.h"
 
-/* matches the System.MonoListItem objcet*/
+/* matches the System.MonoListItem object*/
 struct _MonoMList {
        MonoObject object;
        MonoMList *next;
@@ -41,6 +41,7 @@ mono_mlist_alloc (MonoObject *data)
        if (!monolist_item_vtable) {
                MonoClass *klass = mono_class_from_name (mono_defaults.corlib, "System", "MonoListItem");
                monolist_item_vtable = mono_class_vtable (mono_get_root_domain (), klass);
+               g_assert (monolist_item_vtable);
        }
        res = (MonoMList*)mono_object_new_fast (monolist_item_vtable);
        MONO_OBJECT_SETREF (res, data, data);
@@ -71,6 +72,23 @@ mono_mlist_set_data (MonoMList* list, MonoObject *data)
        MONO_OBJECT_SETREF (list, data, data);
 }
 
+/**
+ * mono_mlist_set_next:
+ * @list: a managed list node
+ * @next: list node that will be next for the @list node.
+ *
+ * Set next node for @list to @next.
+ */
+MonoMList *
+mono_mlist_set_next (MonoMList* list, MonoMList *next)
+{
+       if (!list)
+               return next;
+
+       MONO_OBJECT_SETREF (list, next, next);
+       return list;
+}
+
 /**
  * mono_mlist_length:
  * @list: the managed list
@@ -174,7 +192,7 @@ find_prev (MonoMList* list, MonoMList *item)
 /**
  * mono_mlist_remove_item:
  * @list: the managed list
- * @data: the object to add to the list
+ * @data: the object to remove from the list
  *
  * Remove the list node @item from the managed list @list.
  * Since managed lists are singly-linked, this operation can take O(n) time.