avoid unnecessary preprocessor use for canary mask
This commit is contained in:
parent
93fcc6a978
commit
5811bd184c
8
malloc.c
8
malloc.c
@ -274,11 +274,9 @@ static void write_after_free_check(char *p, size_t size) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
static const uint64_t canary_mask = __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ ?
|
||||||
static const uint64_t canary_mask = 0xffffffffffffff00UL;
|
0xffffffffffffff00UL :
|
||||||
#else
|
0x00ffffffffffffffUL;
|
||||||
static const uint64_t canary_mask = 0x00ffffffffffffffUL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void set_canary(struct slab_metadata *metadata, void *p, size_t size) {
|
static void set_canary(struct slab_metadata *metadata, void *p, size_t size) {
|
||||||
memcpy((char *)p + size - canary_size, &metadata->canary_value, canary_size);
|
memcpy((char *)p + size - canary_size, &metadata->canary_value, canary_size);
|
||||||
|
Loading…
Reference in New Issue
Block a user