Skip to content

Commit 995ce07

Browse files
committed
add is_init likely/unlikely markers
1 parent c9d1abc commit 995ce07

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

h_malloc.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ COLD static void init_slow_path(void) {
10781078

10791079
mutex_lock(&lock);
10801080

1081-
if (is_init()) {
1081+
if (unlikely(is_init())) {
10821082
mutex_unlock(&lock);
10831083
return;
10841084
}
@@ -1823,7 +1823,7 @@ EXPORT struct mallinfo2 h_mallinfo2(void) {
18231823
#endif
18241824

18251825
#if CONFIG_STATS
1826-
if (!is_init()) {
1826+
if (unlikely(!is_init())) {
18271827
return info;
18281828
}
18291829

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

18681868
#if CONFIG_STATS
1869-
if (is_init()) {
1869+
if (likely(is_init())) {
18701870
thread_unseal_metadata();
18711871

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

19371937
#if CONFIG_STATS
1938-
if (!is_init()) {
1938+
if (unlikely(!is_init())) {
19391939
return info;
19401940
}
19411941

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

19771977
#if CONFIG_STATS
1978-
if (!is_init()) {
1978+
if (unlikely(!is_init())) {
19791979
return info;
19801980
}
19811981

0 commit comments

Comments
 (0)