mirror of
https://github.com/samba-team/samba.git
synced 2025-03-12 20:58:37 +03:00
r18521: implement volkers suggestion for avoiding the type punning warnings
(This used to be commit 9b9f058edb033c999c4430add4f05459ac43c9e2)
This commit is contained in:
parent
eb9a2757eb
commit
c902a8927c
@ -741,8 +741,9 @@ void *_talloc_steal(const void *new_ctx, const void *ptr)
|
|||||||
a wrapper around talloc_steal() for situations where you are moving a pointer
|
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
|
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);
|
void *ret = _talloc_steal(new_ctx, *pptr);
|
||||||
(*pptr) = NULL;
|
(*pptr) = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -73,7 +73,7 @@ typedef void TALLOC_CTX;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define talloc_reference(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_reference((ctx),(ptr))
|
#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 */
|
/* useful macros for creating type checked pointers */
|
||||||
#define talloc(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type)
|
#define talloc(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type)
|
||||||
@ -128,7 +128,7 @@ int talloc_free(void *ptr);
|
|||||||
void talloc_free_children(void *ptr);
|
void talloc_free_children(void *ptr);
|
||||||
void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *name);
|
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_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_size(const void *ptr);
|
||||||
size_t talloc_total_blocks(const void *ptr);
|
size_t talloc_total_blocks(const void *ptr);
|
||||||
void talloc_report_depth_cb(const void *ptr, int depth, int max_depth,
|
void talloc_report_depth_cb(const void *ptr, int depth, int max_depth,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user