From 3fd70cad862febf8f1a60bd47576cb758d085958 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sat, 20 Jan 2007 11:50:05 +0000 Subject: Implement memory allocation functions for eglib --- eglib/gmain.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'eglib/gmain.h') diff --git a/eglib/gmain.h b/eglib/gmain.h index 950d4170..c86ab1eb 100644 --- a/eglib/gmain.h +++ b/eglib/gmain.h @@ -136,4 +136,24 @@ void g_slist_free(GSList *list); /* End GSList declarations */ +/* Memory allocation related */ + +gpointer g_malloc(gulong n_bytes); +gpointer g_malloc0(gulong n_bytes); +gpointer g_try_malloc(gulong n_bytes); +gpointer g_try_malloc0(gulong n_bytes); + +void g_free(gpointer mem); + +gchar *g_strdup(const gchar *str); + +#define g_new(struct_type, n_structs) \ + ((struct_type *) g_malloc (((gsize) sizeof (struct_type)) * ((gsize) (n_structs)))) +#define g_new0(struct_type, n_structs) \ + ((struct_type *) g_malloc0 (((gsize) sizeof (struct_type)) * ((gsize) (n_structs)))) +#define g_try_new(struct_type, n_structs) \ + ((struct_type *) g_try_malloc (((gsize) sizeof (struct_type)) * ((gsize) (n_structs)))) +#define g_try_new0(struct_type, n_structs) \ + ((struct_type *) g_try_malloc0 (((gsize) sizeof (struct_type)) * ((gsize) (n_structs)))) + #endif /* __GMAIN_H */ -- cgit