mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-14 11:38:05 +02:00
glib/glib-private: Mark the dynamic LSAN checks as unlikely
It's not normal to run programs with leak sanitizer enabled, so let's mark those checks as such, in case the compiler can optimize them
This commit is contained in:
parent
b11c121747
commit
efe215809b
@ -100,7 +100,7 @@ g_leak_sanitizer_is_supported (void)
|
||||
#if defined (_GLIB_ADDRESS_SANITIZER)
|
||||
return TRUE;
|
||||
#elif defined (HAS_DYNAMIC_ASAN_LOADING)
|
||||
return __lsan_enable != NULL && __lsan_ignore_object != NULL;
|
||||
return G_UNLIKELY (__lsan_enable != NULL && __lsan_ignore_object != NULL);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
@ -122,7 +122,7 @@ g_ignore_leak (gconstpointer p)
|
||||
if (p != NULL)
|
||||
__lsan_ignore_object (p);
|
||||
#elif defined (HAS_DYNAMIC_ASAN_LOADING)
|
||||
if (p != NULL && __lsan_ignore_object != NULL)
|
||||
if (G_LIKELY (p != NULL) && G_UNLIKELY (__lsan_ignore_object != NULL))
|
||||
__lsan_ignore_object (p);
|
||||
#endif
|
||||
}
|
||||
@ -166,7 +166,7 @@ g_begin_ignore_leaks (void)
|
||||
#if defined (_GLIB_ADDRESS_SANITIZER)
|
||||
__lsan_disable ();
|
||||
#elif defined (HAS_DYNAMIC_ASAN_LOADING)
|
||||
if (__lsan_disable != NULL)
|
||||
if (G_UNLIKELY (__lsan_disable != NULL))
|
||||
__lsan_disable ();
|
||||
#endif
|
||||
}
|
||||
@ -183,7 +183,7 @@ g_end_ignore_leaks (void)
|
||||
#if defined (_GLIB_ADDRESS_SANITIZER)
|
||||
__lsan_enable ();
|
||||
#elif defined (HAS_DYNAMIC_ASAN_LOADING)
|
||||
if (__lsan_enable != NULL)
|
||||
if (G_UNLIKELY (__lsan_enable != NULL))
|
||||
__lsan_enable ();
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user