Skip to content

Commit

Permalink
add is_init likely/unlikely markers
Browse files Browse the repository at this point in the history
  • Loading branch information
thestinger committed Jan 22, 2022
1 parent c9d1abc commit 995ce07
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions h_malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ COLD static void init_slow_path(void) {

mutex_lock(&lock);

if (is_init()) {
if (unlikely(is_init())) {
mutex_unlock(&lock);
return;
}
Expand Down Expand Up @@ -1823,7 +1823,7 @@ EXPORT struct mallinfo2 h_mallinfo2(void) {
#endif

#if CONFIG_STATS
if (!is_init()) {
if (unlikely(!is_init())) {
return info;
}

Expand Down Expand Up @@ -1866,7 +1866,7 @@ EXPORT int h_malloc_info(int options, UNUSED FILE *fp) {
fputs("<malloc version=\"hardened_malloc-1\">", fp);

#if CONFIG_STATS
if (is_init()) {
if (likely(is_init())) {
thread_unseal_metadata();

for (unsigned arena = 0; arena < N_ARENA; arena++) {
Expand Down Expand Up @@ -1935,7 +1935,7 @@ EXPORT struct mallinfo h_mallinfo_arena_info(UNUSED size_t arena) {
struct mallinfo info = {0};

#if CONFIG_STATS
if (!is_init()) {
if (unlikely(!is_init())) {
return info;
}

Expand Down Expand Up @@ -1975,7 +1975,7 @@ EXPORT struct mallinfo h_mallinfo_bin_info(UNUSED size_t arena, UNUSED size_t bi
struct mallinfo info = {0};

#if CONFIG_STATS
if (!is_init()) {
if (unlikely(!is_init())) {
return info;
}

Expand Down

0 comments on commit 995ce07

Please sign in to comment.