diff options
author | Neil Brown <neilb@suse.de> | 2006-05-29 02:06:32 +0000 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2006-05-29 02:06:32 +0000 |
commit | b1ec2d6a74ca0a4d139563c2a2a08f7903355843 (patch) | |
tree | c99a96e417d674280202d50ffdba34e4950c1183 /dlink.h | |
parent | 382245c31fb3bad644fcd7d1fe51242304ba594b (diff) | |
download | mdadm-b1ec2d6a74ca0a4d139563c2a2a08f7903355843.tar.gz mdadm-b1ec2d6a74ca0a4d139563c2a2a08f7903355843.tar.xz mdadm-b1ec2d6a74ca0a4d139563c2a2a08f7903355843.zip |
This is to avoid gcc warnings when building with strict-aliasing optimization
fix for another srict-aliasing problem, you can typecast a reference to a
void pointer to anything, you cannot typecast a reference to a
struct.
From: Luca Berra <bluca@vodka.it>
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'dlink.h')
-rw-r--r-- | dlink.h | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -4,16 +4,16 @@ struct __dl_head { - struct __dl_head * dh_prev; - struct __dl_head * dh_next; + void * dh_prev; + void * dh_next; }; #define dl_alloc(size) ((void*)(((char*)calloc(1,(size)+sizeof(struct __dl_head)))+sizeof(struct __dl_head))) #define dl_new(t) ((t*)dl_alloc(sizeof(t))) #define dl_newv(t,n) ((t*)dl_alloc(sizeof(t)*n)) -#define dl_next(p) *((void**)&(((struct __dl_head*)(p))[-1].dh_next)) -#define dl_prev(p) *((void**)&(((struct __dl_head*)(p))[-1].dh_prev)) +#define dl_next(p) *(&(((struct __dl_head*)(p))[-1].dh_next)) +#define dl_prev(p) *(&(((struct __dl_head*)(p))[-1].dh_prev)) void *dl_head(void); char *dl_strdup(char *); |