+2007-06-13 Sven Neumann <sven@gimp.org>
+
+ * glib/gslice.[ch] added g_slice_copy() and g_slice_dup() (#442029).
+
+ * glib/glib.symbols: updated.
+
2007-06-12 Behdad Esfahbod <behdad@gnome.org>
* glib/gunicode.h: Add more G_GNUC_CONST and G_GNUC_PURE.
#if IN_FILE(__G_SLICE_C__)
g_slice_alloc G_GNUC_MALLOC
g_slice_alloc0 G_GNUC_MALLOC
+g_slice_copy G_GNUC_MALLOC
g_slice_free1
g_slice_free_chain_with_offset
g_slice_set_config
return mem;
}
+gpointer
+g_slice_copy (gsize mem_size,
+ gpointer mem_block)
+{
+ gpointer mem = g_slice_alloc (mem_size);
+ if (mem)
+ memcpy (mem, mem_block, mem_size);
+ return mem;
+}
+
void
g_slice_free1 (gsize mem_size,
gpointer mem_block)
*/
gpointer g_slice_alloc (gsize block_size) G_GNUC_MALLOC;
gpointer g_slice_alloc0 (gsize block_size) G_GNUC_MALLOC;
+gpointer g_slice_copy (gsize block_size,
+ gpointer mem_block) G_GNUC_MALLOC;
void g_slice_free1 (gsize block_size,
gpointer mem_block);
void g_slice_free_chain_with_offset (gsize block_size,
gsize next_offset);
#define g_slice_new(type) ((type*) g_slice_alloc (sizeof (type)))
#define g_slice_new0(type) ((type*) g_slice_alloc0 (sizeof (type)))
-/* g_slice_free (MemoryBlockType,
+/* MemoryBlockType *
+ * g_slice_dup (MemoryBlockType,
+ * MemoryBlockType *mem_block);
+ * g_slice_free (MemoryBlockType,
* MemoryBlockType *mem_block);
* g_slice_free_chain (MemoryBlockType,
* MemoryBlockType *first_chain_block,
*/
/* we go through extra hoops to ensure type safety */
+#define g_slice_dup(type, mem) \
+ (1 ? g_slice_copy (sizeof (type), (mem)) : (type*) ((type*) 0 == (mem)))
#define g_slice_free(type, mem) do { \
if (1) g_slice_free1 (sizeof (type), (mem)); \
else (void) ((type*) 0 == (mem)); \