isl_*alloc macros: return expression of desired type
authorSven Verdoolaege <skimo@kotnet.org>
Fri, 16 Mar 2012 14:42:50 +0000 (15:42 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Fri, 16 Mar 2012 14:44:05 +0000 (15:44 +0100)
The type information was dropped in 157122e (Check the ctx argument of the
memory macros, Tue Jun 7 16:15:15 2011 -0300).

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
include/isl/ctx.h

index 57ddc65..915bf11 100644 (file)
@@ -102,19 +102,20 @@ typedef struct isl_ctx isl_ctx;
  * returns the value of 'expr'. It is used to ensure, that always an isl_ctx is
  * passed to the following macros, even if they currently do not use it.
  */
-#define isl_check_ctx(ctx, expr)       (ctx != (isl_ctx *) 0) ? expr : expr
-
-#define isl_alloc(ctx,type,size)       isl_check_ctx(ctx, (type *)malloc(size))
-#define isl_calloc(ctx,type,size)      isl_check_ctx(ctx, \
-                                               (type *)calloc(1, size))
-#define isl_realloc(ctx,ptr,type,size) isl_check_ctx(ctx, \
-                                               (type *)realloc(ptr,size))
+#define isl_check_ctx(ctx, expr)       ((ctx != (isl_ctx *) 0) ? expr : expr)
+
+#define isl_alloc(ctx,type,size)       ((type *)isl_check_ctx(ctx,\
+                                                       malloc(size)))
+#define isl_calloc(ctx,type,size)      ((type *)isl_check_ctx(ctx,\
+                                                       calloc(1, size)))
+#define isl_realloc(ctx,ptr,type,size) ((type *)isl_check_ctx(ctx,\
+                                                       realloc(ptr,size)))
 #define isl_alloc_type(ctx,type)       isl_alloc(ctx,type,sizeof(type))
 #define isl_calloc_type(ctx,type)      isl_calloc(ctx,type,sizeof(type))
 #define isl_realloc_type(ctx,ptr,type) isl_realloc(ctx,ptr,type,sizeof(type))
 #define isl_alloc_array(ctx,type,n)    isl_alloc(ctx,type,(n)*sizeof(type))
-#define isl_calloc_array(ctx,type,n)   isl_check_ctx(ctx,\
-                                               (type *)calloc(n, sizeof(type)))
+#define isl_calloc_array(ctx,type,n)   ((type *)isl_check_ctx(ctx,\
+                                               calloc(n, sizeof(type))))
 #define isl_realloc_array(ctx,ptr,type,n) \
                                    isl_realloc(ctx,ptr,type,(n)*sizeof(type))