summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Roskin <plroskin@gmail.com>2016-06-21 16:30:18 -0700
committerPavel Roskin <plroskin@gmail.com>2016-07-08 04:29:49 +0000
commita24df49241adc7c49dff777742d668f1d6c690ad (patch)
treef953e6f4b9199cb233e3a97ee7ce150aaff742f6
parent6ab8c5ac6e444e507d0875c3409c576044750b01 (diff)
downloadxrdp-proprietary-a24df49241adc7c49dff777742d668f1d6c690ad.tar.gz
xrdp-proprietary-a24df49241adc7c49dff777742d668f1d6c690ad.zip
Introduce glib style macros for allocating memory with type
-rw-r--r--common/os_calls.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/os_calls.h b/common/os_calls.h
index 6a7cd093..a843b2e7 100644
--- a/common/os_calls.h
+++ b/common/os_calls.h
@@ -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