File shared-Add-pointer-and-memory-macros.patch of Package bluez.27456

From edb12d9fa24817ff0dc5e6bd3f68c086ee12bd05 Mon Sep 17 00:00:00 2001
From: Marcel Holtmann <marcel@holtmann.org>
Date: Fri, 27 Dec 2013 19:29:31 -0800
Subject: [PATCH] shared: Add pointer and memory macros

---
 src/shared/util.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/shared/util.h b/src/shared/util.h
index 88e89540e..cc03547b5 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -21,6 +21,19 @@
  *
  */
 
+#include <stdlib.h>
+#include <alloca.h>
+
+#define PTR_TO_UINT(p) ((unsigned int) ((uintptr_t) (p)))
+#define UINT_TO_PTR(u) ((void *) ((uintptr_t) (u)))
+
+#define PTR_TO_INT(p) ((int) ((intptr_t) (p)))
+#define INT_TO_PTR(u) ((void *) ((intptr_t) (u)))
+
+#define new0(t, n) ((t*) calloc((n), sizeof(t)))
+#define newa(t, n) ((t*) alloca(sizeof(t)*(n)))
+#define malloc0(n) (calloc((n), 1))
+
 typedef void (*util_debug_func_t)(const char *str, void *user_data);
 
 void util_debug(util_debug_func_t function, void *user_data,
-- 
2.35.3

openSUSE Build Service is sponsored by