mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-21 16:38:54 +02:00
glib/gslice.[ch] added g_slice_copy() and g_slice_dup() (#442029).
2007-06-13 Sven Neumann <sven@gimp.org> * glib/gslice.[ch] added g_slice_copy() and g_slice_dup() (#442029). * glib/glib.symbols: updated. svn path=/trunk/; revision=5554
This commit is contained in:
committed by
Sven Neumann
parent
94327cb6a7
commit
57336cec3f
@@ -1,3 +1,9 @@
|
|||||||
|
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>
|
2007-06-12 Behdad Esfahbod <behdad@gnome.org>
|
||||||
|
|
||||||
* glib/gunicode.h: Add more G_GNUC_CONST and G_GNUC_PURE.
|
* glib/gunicode.h: Add more G_GNUC_CONST and G_GNUC_PURE.
|
||||||
|
@@ -684,6 +684,7 @@ g_blow_chunks
|
|||||||
#if IN_FILE(__G_SLICE_C__)
|
#if IN_FILE(__G_SLICE_C__)
|
||||||
g_slice_alloc G_GNUC_MALLOC
|
g_slice_alloc G_GNUC_MALLOC
|
||||||
g_slice_alloc0 G_GNUC_MALLOC
|
g_slice_alloc0 G_GNUC_MALLOC
|
||||||
|
g_slice_copy G_GNUC_MALLOC
|
||||||
g_slice_free1
|
g_slice_free1
|
||||||
g_slice_free_chain_with_offset
|
g_slice_free_chain_with_offset
|
||||||
g_slice_set_config
|
g_slice_set_config
|
||||||
|
@@ -815,6 +815,16 @@ g_slice_alloc0 (gsize mem_size)
|
|||||||
return mem;
|
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
|
void
|
||||||
g_slice_free1 (gsize mem_size,
|
g_slice_free1 (gsize mem_size,
|
||||||
gpointer mem_block)
|
gpointer mem_block)
|
||||||
|
@@ -31,6 +31,8 @@ G_BEGIN_DECLS
|
|||||||
*/
|
*/
|
||||||
gpointer g_slice_alloc (gsize block_size) G_GNUC_MALLOC;
|
gpointer g_slice_alloc (gsize block_size) G_GNUC_MALLOC;
|
||||||
gpointer g_slice_alloc0 (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,
|
void g_slice_free1 (gsize block_size,
|
||||||
gpointer mem_block);
|
gpointer mem_block);
|
||||||
void g_slice_free_chain_with_offset (gsize block_size,
|
void g_slice_free_chain_with_offset (gsize block_size,
|
||||||
@@ -38,7 +40,10 @@ void g_slice_free_chain_with_offset (gsize block_size,
|
|||||||
gsize next_offset);
|
gsize next_offset);
|
||||||
#define g_slice_new(type) ((type*) g_slice_alloc (sizeof (type)))
|
#define g_slice_new(type) ((type*) g_slice_alloc (sizeof (type)))
|
||||||
#define g_slice_new0(type) ((type*) g_slice_alloc0 (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);
|
* MemoryBlockType *mem_block);
|
||||||
* g_slice_free_chain (MemoryBlockType,
|
* g_slice_free_chain (MemoryBlockType,
|
||||||
* MemoryBlockType *first_chain_block,
|
* MemoryBlockType *first_chain_block,
|
||||||
@@ -48,6 +53,8 @@ void g_slice_free_chain_with_offset (gsize block_size,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* we go through extra hoops to ensure type safety */
|
/* 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 { \
|
#define g_slice_free(type, mem) do { \
|
||||||
if (1) g_slice_free1 (sizeof (type), (mem)); \
|
if (1) g_slice_free1 (sizeof (type), (mem)); \
|
||||||
else (void) ((type*) 0 == (mem)); \
|
else (void) ((type*) 0 == (mem)); \
|
||||||
|
Reference in New Issue
Block a user