mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 07:07:04 +02:00
CLEANUP: use "offsetof" where appropriate
let's use the C library macro "offsetof"
This commit is contained in:
parent
b5efe7901d
commit
2ca01589a0
@ -425,12 +425,12 @@ static void delete_entry(struct cache_entry *del_entry)
|
||||
|
||||
static inline struct shared_context *shctx_ptr(struct cache *cache)
|
||||
{
|
||||
return (struct shared_context *)((unsigned char *)cache - ((struct shared_context *)NULL)->data);
|
||||
return (struct shared_context *)((unsigned char *)cache - offsetof(struct shared_context, data));
|
||||
}
|
||||
|
||||
static inline struct shared_block *block_ptr(struct cache_entry *entry)
|
||||
{
|
||||
return (struct shared_block *)((unsigned char *)entry - ((struct shared_block *)NULL)->data);
|
||||
return (struct shared_block *)((unsigned char *)entry - offsetof(struct shared_block, data));
|
||||
}
|
||||
|
||||
|
||||
|
@ -4205,7 +4205,7 @@ static inline void sh_ssl_sess_free_blocks(struct shared_block *first, struct sh
|
||||
/* return first block from sh_ssl_sess */
|
||||
static inline struct shared_block *sh_ssl_sess_first_block(struct sh_ssl_sess_hdr *sh_ssl_sess)
|
||||
{
|
||||
return (struct shared_block *)((unsigned char *)sh_ssl_sess - ((struct shared_block *)NULL)->data);
|
||||
return (struct shared_block *)((unsigned char *)sh_ssl_sess - offsetof(struct shared_block, data));
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user