File indexing completed on 2026-05-06 08:41:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef __G_SLICE_H__
0021 #define __G_SLICE_H__
0022
0023 #if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
0024 #error "Only <glib.h> can be included directly."
0025 #endif
0026
0027 #include <glib/gtypes.h>
0028 #include <string.h>
0029
0030 G_BEGIN_DECLS
0031
0032
0033
0034 GLIB_AVAILABLE_IN_ALL
0035 gpointer g_slice_alloc (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
0036 GLIB_AVAILABLE_IN_ALL
0037 gpointer g_slice_alloc0 (gsize block_size) G_GNUC_MALLOC G_GNUC_ALLOC_SIZE(1);
0038 GLIB_AVAILABLE_IN_ALL
0039 gpointer g_slice_copy (gsize block_size,
0040 gconstpointer mem_block) G_GNUC_ALLOC_SIZE(1);
0041 GLIB_AVAILABLE_IN_ALL
0042 void g_slice_free1 (gsize block_size,
0043 gpointer mem_block);
0044 GLIB_AVAILABLE_IN_ALL
0045 void g_slice_free_chain_with_offset (gsize block_size,
0046 gpointer mem_chain,
0047 gsize next_offset);
0048 #define g_slice_new(type) ((type*) g_slice_alloc (sizeof (type)))
0049
0050
0051
0052 #if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__)
0053 # define g_slice_new0(type) \
0054 (type *) (G_GNUC_EXTENSION ({ \
0055 gsize __s = sizeof (type); \
0056 gpointer __p; \
0057 __p = g_slice_alloc (__s); \
0058 memset (__p, 0, __s); \
0059 __p; \
0060 }))
0061 #else
0062 # define g_slice_new0(type) ((type*) g_slice_alloc0 (sizeof (type)))
0063 #endif
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078 #define g_slice_dup(type, mem) \
0079 (1 ? (type*) g_slice_copy (sizeof (type), (mem)) \
0080 : ((void) ((type*) 0 == (mem)), (type*) 0))
0081 #define g_slice_free(type, mem) \
0082 G_STMT_START { \
0083 if (1) g_slice_free1 (sizeof (type), (mem)); \
0084 else (void) ((type*) 0 == (mem)); \
0085 } G_STMT_END
0086 #define g_slice_free_chain(type, mem_chain, next) \
0087 G_STMT_START { \
0088 if (1) g_slice_free_chain_with_offset (sizeof (type), \
0089 (mem_chain), G_STRUCT_OFFSET (type, next)); \
0090 else (void) ((type*) 0 == (mem_chain)); \
0091 } G_STMT_END
0092
0093
0094 typedef enum {
0095 G_SLICE_CONFIG_ALWAYS_MALLOC = 1,
0096 G_SLICE_CONFIG_BYPASS_MAGAZINES,
0097 G_SLICE_CONFIG_WORKING_SET_MSECS,
0098 G_SLICE_CONFIG_COLOR_INCREMENT,
0099 G_SLICE_CONFIG_CHUNK_SIZES,
0100 G_SLICE_CONFIG_CONTENTION_COUNTER
0101 } GSliceConfig;
0102
0103 GLIB_DEPRECATED_IN_2_34
0104 void g_slice_set_config (GSliceConfig ckey, gint64 value);
0105 GLIB_DEPRECATED_IN_2_34
0106 gint64 g_slice_get_config (GSliceConfig ckey);
0107 GLIB_DEPRECATED_IN_2_34
0108 gint64* g_slice_get_config_state (GSliceConfig ckey, gint64 address, guint *n_values);
0109
0110 #ifndef __GI_SCANNER__
0111 #ifdef G_ENABLE_DEBUG
0112 GLIB_AVAILABLE_IN_ALL
0113 void g_slice_debug_tree_statistics (void);
0114 #endif
0115 #endif
0116
0117 G_END_DECLS
0118
0119 #endif