summaryrefslogtreecommitdiffstats
path: root/libdimension/list.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-05-07 11:57:07 -0600
committerTavian Barnes <tavianator@gmail.com>2010-05-07 11:57:07 -0600
commit9adb64786e6aa8f5f0fca39a67e96c495058fd1e (patch)
treeafb42b751972e2a806d717c8ba1eae1554785859 /libdimension/list.c
parentadb8a2cd0d7bf835f987fa6a6202545cb7336956 (diff)
downloaddimension-9adb64786e6aa8f5f0fca39a67e96c495058fd1e.tar.xz
New dmnsn_array_from_list() function.
Diffstat (limited to 'libdimension/list.c')
-rw-r--r--libdimension/list.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libdimension/list.c b/libdimension/list.c
index 5b03209..0c01e68 100644
--- a/libdimension/list.c
+++ b/libdimension/list.c
@@ -32,6 +32,21 @@ dmnsn_list_from_array(const dmnsn_array *array)
return list;
}
+dmnsn_array *
+dmnsn_array_from_list(const dmnsn_list *list)
+{
+ dmnsn_array *array = dmnsn_new_array(list->obj_size);
+
+ for (dmnsn_list_iterator *i = dmnsn_list_first(list);
+ i != NULL;
+ i = dmnsn_list_next(i))
+ {
+ dmnsn_array_push(array, i->ptr);
+ }
+
+ return array;
+}
+
void
dmnsn_delete_list(dmnsn_list *list)
{