Skip to content

Commit 2c4595f

Browse files
committed
clang format
1 parent c5ab31f commit 2c4595f

5 files changed

Lines changed: 31 additions & 31 deletions

File tree

include/conf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
/* See PERFORMANCE.md for notes on huge page sizes.
6666
* If your system uses a non-default value for huge
6767
* page sizes you will need to adjust that here */
68-
#if(__linux__ && MAP_HUGETLB) || (__APPLE__ && VM_FLAGS_SUPERPAGE_SIZE_2MB) || (__FreeBSD__ && MAP_HUGETLB) && HUGE_PAGES
68+
#if (__linux__ && MAP_HUGETLB) || (__APPLE__ && VM_FLAGS_SUPERPAGE_SIZE_2MB) || (__FreeBSD__ && MAP_HUGETLB) && HUGE_PAGES
6969
#define HUGE_PAGE_SZ 2097152
7070
#endif
7171

include/iso_alloc_ds.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,31 @@ typedef struct {
3131
/* Hot fields: all fit within the first 64-byte cache line.
3232
* These are accessed on every alloc/free operation, so keeping
3333
* them colocated avoids extra cache misses */
34-
void *user_pages_start; /* Start of the pages backing this zone */
35-
void *bitmap_start; /* Start of the bitmap */
36-
int64_t next_free_bit_slot; /* The last bit slot returned by get_next_free_bit_slot */
37-
uint64_t canary_secret; /* Each zone has its own canary secret */
38-
uint64_t pointer_mask; /* Each zone has its own pointer protection secret */
39-
bitmap_index_t max_bitmap_idx; /* Max bitmap index for this bitmap */
40-
uint32_t chunk_size; /* Size of chunks managed by this zone */
41-
free_bit_slot_t free_bit_slots_usable; /* The oldest members of the free cache are served first */
42-
free_bit_slot_t free_bit_slots_index; /* Tracks how many entries in the cache are filled */
43-
bool is_full; /* Flags whether this zone is full to avoid bit slot searches */
44-
bool internal; /* Zones can be managed by iso_alloc or private */
34+
void *user_pages_start; /* Start of the pages backing this zone */
35+
void *bitmap_start; /* Start of the bitmap */
36+
int64_t next_free_bit_slot; /* The last bit slot returned by get_next_free_bit_slot */
37+
uint64_t canary_secret; /* Each zone has its own canary secret */
38+
uint64_t pointer_mask; /* Each zone has its own pointer protection secret */
39+
bitmap_index_t max_bitmap_idx; /* Max bitmap index for this bitmap */
40+
uint32_t chunk_size; /* Size of chunks managed by this zone */
41+
free_bit_slot_t free_bit_slots_usable; /* The oldest members of the free cache are served first */
42+
free_bit_slot_t free_bit_slots_index; /* Tracks how many entries in the cache are filled */
43+
bool is_full; /* Flags whether this zone is full to avoid bit slot searches */
44+
bool internal; /* Zones can be managed by iso_alloc or private */
4545
#if MEMORY_TAGGING
46-
bool tagged; /* Zone supports memory tagging */
46+
bool tagged; /* Zone supports memory tagging */
4747
#endif
48-
int8_t preallocated_bitmap_idx; /* The bitmap is preallocated and its index */
48+
int8_t preallocated_bitmap_idx; /* The bitmap is preallocated and its index */
4949
#if CPU_PIN
50-
uint8_t cpu_core; /* What CPU core this zone is pinned to */
50+
uint8_t cpu_core; /* What CPU core this zone is pinned to */
5151
#endif
5252
/* Warm/cold fields: accessed less frequently */
53-
uint32_t bitmap_size; /* Size of the bitmap in bytes */
54-
uint32_t af_count; /* Increment/Decrement with each alloc/free operation */
55-
uint32_t chunk_count; /* Total number of chunks in this zone */
56-
uint32_t alloc_count; /* Total number of lifetime allocations */
57-
uint16_t index; /* Zone index */
58-
uint16_t next_sz_index; /* What is the index of the next zone of this size */
53+
uint32_t bitmap_size; /* Size of the bitmap in bytes */
54+
uint32_t af_count; /* Increment/Decrement with each alloc/free operation */
55+
uint32_t chunk_count; /* Total number of chunks in this zone */
56+
uint32_t alloc_count; /* Total number of lifetime allocations */
57+
uint16_t index; /* Zone index */
58+
uint16_t next_sz_index; /* What is the index of the next zone of this size */
5959
/* Large cold array: only accessed when refilling the free list */
6060
bit_slot_t free_bit_slots[ZONE_FREE_LIST_SZ]; /* A cache of bit slots that point to freed chunks */
6161
} __attribute__((packed, aligned(sizeof(int64_t)))) iso_alloc_zone_t;

src/iso_alloc.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ INTERNAL_HIDDEN iso_alloc_zone_t *_iso_new_zone(size_t size, bool internal, int3
449449
p = mmap_rw_pages(total_size, false, name);
450450
#endif
451451

452-
#if(__ANDROID__ || KERNEL_VERSION_SEQ_5_17) && NAMED_MAPPINGS && MEMORY_TAGGING
452+
#if (__ANDROID__ || KERNEL_VERSION_SEQ_5_17) && NAMED_MAPPINGS && MEMORY_TAGGING
453453
if(new_zone->tagged == false) {
454454
name = MEM_TAG_NAME;
455455
}
@@ -605,7 +605,7 @@ INTERNAL_HIDDEN void fill_free_bit_slots(iso_alloc_zone_t *zone) {
605605
} else {
606606
/* Use ctzll to skip directly to each free slot instead
607607
* of iterating all 32 even-bit positions */
608-
uint64_t free_mask = ~(uint64_t)bts & USED_BIT_VECTOR;
608+
uint64_t free_mask = ~(uint64_t) bts & USED_BIT_VECTOR;
609609

610610
while(free_mask) {
611611
free_bit_slots[free_bit_slots_index] = (bm_idx_shf + __builtin_ctzll(free_mask));
@@ -738,12 +738,12 @@ INTERNAL_HIDDEN bit_slot_t iso_scan_zone_free_slot_slow(iso_alloc_zone_t *zone)
738738
* scanning bit-by-bit. USED_BIT_VECTOR selects even-position
739739
* bits (one per chunk); inverting gives 1s where chunks are
740740
* free (use bitwise ops on multiple values) */
741-
uint64_t free_mask0 = ~(uint64_t)vgetq_lane_s64(im, 0) & USED_BIT_VECTOR;
741+
uint64_t free_mask0 = ~(uint64_t) vgetq_lane_s64(im, 0) & USED_BIT_VECTOR;
742742
if(free_mask0) {
743743
return ((i << BITS_PER_QWORD_SHIFT) + __builtin_ctzll(free_mask0));
744744
}
745745

746-
uint64_t free_mask1 = ~(uint64_t)vgetq_lane_s64(im, 1) & USED_BIT_VECTOR;
746+
uint64_t free_mask1 = ~(uint64_t) vgetq_lane_s64(im, 1) & USED_BIT_VECTOR;
747747
if(free_mask1) {
748748
return (((i + 1) << BITS_PER_QWORD_SHIFT) + __builtin_ctzll(free_mask1));
749749
}
@@ -757,15 +757,15 @@ INTERNAL_HIDDEN bit_slot_t iso_scan_zone_free_slot_slow(iso_alloc_zone_t *zone)
757757
max = (zone->max_bitmap_idx >> 1);
758758

759759
for(size_t i = 0; i < max; i++) {
760-
unsigned __int128 bts = (unsigned __int128)ebm[i];
760+
unsigned __int128 bts = (unsigned __int128) ebm[i];
761761

762762
/* Split 128-bit word into two 64-bit halves and use ctzll */
763-
uint64_t free_lo = ~(uint64_t)bts & USED_BIT_VECTOR;
763+
uint64_t free_lo = ~(uint64_t) bts & USED_BIT_VECTOR;
764764
if(free_lo) {
765765
return ((i << BITS_PER_ODWORD_SHIFT) + __builtin_ctzll(free_lo));
766766
}
767767

768-
uint64_t free_hi = ~(uint64_t)(bts >> 64) & USED_BIT_VECTOR;
768+
uint64_t free_hi = ~(uint64_t) (bts >> 64) & USED_BIT_VECTOR;
769769
if(free_hi) {
770770
return ((i << BITS_PER_ODWORD_SHIFT) + 64 + __builtin_ctzll(free_hi));
771771
}
@@ -774,7 +774,7 @@ INTERNAL_HIDDEN bit_slot_t iso_scan_zone_free_slot_slow(iso_alloc_zone_t *zone)
774774
bm = (bitmap_index_t *) zone->bitmap_start;
775775

776776
for(bitmap_index_t i = max; i < zone->max_bitmap_idx; i++) {
777-
uint64_t free_mask = ~(uint64_t)bm[i] & USED_BIT_VECTOR;
777+
uint64_t free_mask = ~(uint64_t) bm[i] & USED_BIT_VECTOR;
778778
if(free_mask) {
779779
return ((i << BITS_PER_QWORD_SHIFT) + __builtin_ctzll(free_mask));
780780
}

src/iso_alloc_search.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ INTERNAL_HIDDEN void *_iso_alloc_ptr_search(void *n, bool poison) {
2424
end = search + ZONE_USER_SIZE;
2525

2626
while(search <= (uint8_t *) (end - sizeof(uint64_t))) {
27-
if(LIKELY((uint64_t) * (uint64_t *) search != (uint64_t) n)) {
27+
if(LIKELY((uint64_t) *(uint64_t *) search != (uint64_t) n)) {
2828
search++;
2929
} else {
3030
if(poison == false) {

src/libc_hook.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ EXTERNAL_API void *memset(void *dest, int b, size_t n) {
2323
/*
2424
* bzero is removed from the POSIX standard in IEEE Std 1003.1-2008, but still a valid *BSD extension
2525
*/
26-
#if(__FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__)
26+
#if (__FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__)
2727
EXTERNAL_API void bzero(void *dest, size_t n) {
2828
(void) _iso_alloc_memset(dest, 0, n);
2929
}

0 commit comments

Comments
 (0)