glib/glib-sections.txt document g_slice_copy() and g_slice_dup().
authorSven Neumann <sven@gimp.org>
Wed, 13 Jun 2007 18:58:49 +0000 (18:58 +0000)
committerSven Neumann <neo@src.gnome.org>
Wed, 13 Jun 2007 18:58:49 +0000 (18:58 +0000)
2007-06-13  Sven Neumann  <sven@gimp.org>

* glib/glib-sections.txt
* glib/tmpl/memory_slices.sgml: document g_slice_copy() and
g_slice_dup().

svn path=/trunk/; revision=5555

docs/reference/ChangeLog
docs/reference/glib/glib-sections.txt
docs/reference/glib/tmpl/memory_slices.sgml

index 363743e..41f09a9 100644 (file)
@@ -1,3 +1,9 @@
+2007-06-13  Sven Neumann  <sven@gimp.org>
+
+       * glib/glib-sections.txt
+       * glib/tmpl/memory_slices.sgml: document g_slice_copy() and
+       g_slice_dup().
+
 2007-06-13  Matthias Clasen  <mclasen@redhat.com>
 
        * glib/tmpl/warnings.sgml: Add some verbiage about
index 9912902..d445062 100644 (file)
@@ -1735,12 +1735,14 @@ g_mem_chunk_print
 <FILE>memory_slices</FILE>
 g_slice_alloc
 g_slice_alloc0
+g_slice_copy
 g_slice_free1
 g_slice_free_chain_with_offset
 
 <SUBSECTION>
 g_slice_new
 g_slice_new0
+g_slice_dup
 g_slice_free
 g_slice_free_chain
 
index 372192c..a562ffe 100644 (file)
@@ -121,6 +121,18 @@ environment variable.
 @Since: 2.10
 
 
+<!-- ##### FUNCTION g_slice_copy ##### -->
+<para>
+Allocates a block of memory from the slice allocator and copies
+@block_size bytes into it from @mem_block.
+</para>
+
+@block_size: the number of bytes to allocate
+@mem_block: the memory to copy
+@Returns: a pointer to the allocated memory block
+@Since: 2.14
+
+
 <!-- ##### FUNCTION g_slice_free1 ##### -->
 <para>
 Frees a block of memory. The memory must have been allocated via
@@ -186,6 +198,23 @@ environment variable.
 @Since: 2.10
 
 
+<!-- ##### MACRO g_slice_dup ##### -->
+<para>
+A convenience macro to duplicate a block of memory using the slice allocator.
+It calls g_slice_copy() with <literal>sizeof (@type)</literal> and casts 
+the returned pointer to a pointer of the given type, avoiding a type cast 
+in the source code.
+Note that the underlying slice allocation mechanism can
+be changed with the <link linkend="G_SLICE">G_SLICE=always-malloc</link>
+environment variable.
+</para>
+
+@type: the type to duplicate, typically a structure name
+@mem: the memory to copy into the allocated block
+@Returns: a pointer to the allocated block, cast to a pointer to @type.
+@Since: 2.14
+
+
 <!-- ##### MACRO g_slice_free ##### -->
 <para>
 A convenience macro to free a block of memory that has been allocated