gfsmMem.h File Reference

Memory utilities. More...

#include <glib.h>
#include <gfsmConfig.h>
#include <gfsmMem.hi>
Include dependency graph for gfsmMem.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Slice Allocators

#define gfsm_slice_new(type)   g_new(type,1)
#define gfsm_slice_new_n(type, n)   (type*)g_malloc(sizeof(type)*(n))
#define gfsm_slice_new0(type)   g_new0(type,1)
#define gfsm_slice_new0_n(type, n)   (type*)g_malloc0(sizeof(type)*(n))
#define gfsm_slice_dup(type, mem)   g_memdup((mem),sizeof(type))
#define gfsm_slice_free(type, mem)   g_free((mem))
#define gfsm_slice_free_n(type, mem, n)   g_free((gpointer)(mem))
static gpointer gfsm_slice_alloc (guint block_size)
static gpointer gfsm_slice_alloc0 (guint block_size)
static gpointer gfsm_slice_copy (guint block_size, gconstpointer src)
static void gfsm_slice_free1 (gsize block_size, gpointer mem_block)

Allocation Copying utiltities (using g_new())

#define gfsm_new(struct_type, n_structs)   g_new(struct_type, (n_structs))
#define gfsm_new0(struct_type, n_structs)   g_new0(struct_type, (n_structs))
#define gfsm_string_dup   g_strdup
typedef gpointer(* gfsmDupNFunc )(gconstpointer src, gsize size)
typedef gpointer(* gfsmDupFunc )(gconstpointer src)
static void gfsm_free (gpointer mem)
static gpointer gfsm_string_dup_n (gconstpointer src, gsize size)
static gpointer gfsm_mem_dup_n (gconstpointer src, gsize size)
static GString * gfsm_gstring_dup (GString *gstr)
static void gfsm_gstring_assign_bytes (GString *gstr, const gchar *src, gsize len)
static GString * gfsm_gstring_new_bytes (const gchar *src, gsize len)

Detailed Description

Macro Definition Documentation

#define gfsm_slice_new (   type)    g_new(type,1)

Wrapper for g_slice_new(type)

#define gfsm_slice_new_n (   type,
 
)    (type*)g_malloc(sizeof(type)*(n))

Wrapper for g_slice_alloc(sizeof(type)*n)

#define gfsm_slice_new0 (   type)    g_new0(type,1)

Wrapper for g_slice_new0(type)

#define gfsm_slice_new0_n (   type,
 
)    (type*)g_malloc0(sizeof(type)*(n))

Wrapper for g_slice_alloc0(sizeof(type)*n)

#define gfsm_slice_dup (   type,
  mem 
)    g_memdup((mem),sizeof(type))

Wrapper for g_slice_dup(type,mem)

#define gfsm_slice_free (   type,
  mem 
)    g_free((mem))

Wrapper for g_slice_free(type,mem)

#define gfsm_slice_free_n (   type,
  mem,
 
)    g_free((gpointer)(mem))

Wrapper for g_slice_free1(sizeof(type)*n,mem)

#define gfsm_new (   struct_type,
  n_structs 
)    g_new(struct_type, (n_structs))

Wrapper for g_new()

#define gfsm_new0 (   struct_type,
  n_structs 
)    g_new0(struct_type, (n_structs))

Wrapper for g_new0()

#define gfsm_string_dup   g_strdup

String duplication function for NUL-terminated strings

Typedef Documentation

typedef gpointer(* gfsmDupNFunc)(gconstpointer src, gsize size)

Abstract copy function

typedef gpointer(* gfsmDupFunc)(gconstpointer src)

Abstract duplication function

Function Documentation

static gpointer gfsm_slice_alloc ( guint  block_size)
inlinestatic

Allocate a constant-size block of memory using g_slice_alloc()

static gpointer gfsm_slice_alloc0 ( guint  block_size)
inlinestatic

Allocate and zero a constant-size block of memory using g_slice_alloc0()

static gpointer gfsm_slice_copy ( guint  block_size,
gconstpointer  src 
)
inlinestatic

Allocate constant-size block of memory and copy data from src into it

static void gfsm_slice_free1 ( gsize  block_size,
gpointer  mem_block 
)
inlinestatic

Free a constant-size block of memory allocated with gfsm_slice_alloc()

static void gfsm_free ( gpointer  mem)
inlinestatic

Wrapper for g_free()

static gpointer gfsm_string_dup_n ( gconstpointer  src,
gsize  size 
)
inlinestatic

String copy function for NUL-terminated strings

static gpointer gfsm_mem_dup_n ( gconstpointer  src,
gsize  size 
)
inlinestatic

size-based copy function

static GString* gfsm_gstring_dup ( GString *  gstr)
inlinestatic

String duplication function for GString*s

static void gfsm_gstring_assign_bytes ( GString *  gstr,
const gchar *  src,
gsize  len 
)
inlinestatic

Byte-assignment for GString*s

static GString* gfsm_gstring_new_bytes ( const gchar *  src,
gsize  len 
)
inlinestatic

Byte-vector creation for GString*s