Introduce glib style macros for allocating memory with type

master
Pavel Roskin 9 years ago
parent 6ab8c5ac6e
commit a24df49241

@ -25,6 +25,7 @@
#define NULL 0
#endif
#include <stdlib.h>
#include "arch.h"
#define g_tcp_can_recv g_sck_can_recv
@ -183,4 +184,10 @@ int APP_CC g_shmdt(const void *shmaddr);
int APP_CC g_gethostname(char *name, int len);
int APP_CC g_mirror_memcpy(void *dst, const void *src, int len);
/* glib-style wrappers */
#define g_new(struct_type, n_structs) \
(struct_type *) malloc(sizeof(struct_type) * (n_structs))
#define g_new0(struct_type, n_structs) \
(struct_type *) calloc((n_structs), sizeof(struct_type))
#endif

Loading…
Cancel
Save