avoid unnecessary preprocessor use for canary mask

This commit is contained in:
Daniel Micay 2018-10-03 17:17:20 -04:00
parent 93fcc6a978
commit 5811bd184c

View File

@ -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 = 0xffffffffffffff00UL;
#else
static const uint64_t canary_mask = 0x00ffffffffffffffUL;
#endif
static const uint64_t canary_mask = __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ ?
0xffffffffffffff00UL :
0x00ffffffffffffffUL;
static void set_canary(struct slab_metadata *metadata, void *p, size_t size) {
memcpy((char *)p + size - canary_size, &metadata->canary_value, canary_size);