Author: tridge Date: 2006-09-14 12:18:44 +0000 (Thu, 14 Sep 2006) New Revision: 18521
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18521 Log: implement volkers suggestion for avoiding the type punning warnings Modified: branches/SAMBA_4_0/source/lib/talloc/talloc.c branches/SAMBA_4_0/source/lib/talloc/talloc.h Changeset: Modified: branches/SAMBA_4_0/source/lib/talloc/talloc.c =================================================================== --- branches/SAMBA_4_0/source/lib/talloc/talloc.c 2006-09-14 12:08:06 UTC (rev 18520) +++ branches/SAMBA_4_0/source/lib/talloc/talloc.c 2006-09-14 12:18:44 UTC (rev 18521) @@ -741,8 +741,9 @@ a wrapper around talloc_steal() for situations where you are moving a pointer between two structures, and want the old pointer to be set to NULL */ -void *_talloc_move(const void *new_ctx, const void **pptr) +void *_talloc_move(const void *new_ctx, const void *_pptr) { + const void **pptr = (const void **)_pptr; void *ret = _talloc_steal(new_ctx, *pptr); (*pptr) = NULL; return ret; Modified: branches/SAMBA_4_0/source/lib/talloc/talloc.h =================================================================== --- branches/SAMBA_4_0/source/lib/talloc/talloc.h 2006-09-14 12:08:06 UTC (rev 18520) +++ branches/SAMBA_4_0/source/lib/talloc/talloc.h 2006-09-14 12:18:44 UTC (rev 18521) @@ -73,7 +73,7 @@ #endif #define talloc_reference(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_reference((ctx),(ptr)) -#define talloc_move(ctx, ptr) (_TALLOC_TYPEOF(*(ptr)))_talloc_move((ctx),(const void **)(ptr)) +#define talloc_move(ctx, ptr) (_TALLOC_TYPEOF(*(ptr)))_talloc_move((ctx),(void *)(ptr)) /* useful macros for creating type checked pointers */ #define talloc(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type) @@ -128,7 +128,7 @@ void talloc_free_children(void *ptr); void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *name); void *_talloc_steal(const void *new_ctx, const void *ptr); -void *_talloc_move(const void *new_ctx, const void **pptr); +void *_talloc_move(const void *new_ctx, const void *pptr); size_t talloc_total_size(const void *ptr); size_t talloc_total_blocks(const void *ptr); void talloc_report_depth_cb(const void *ptr, int depth, int max_depth,