1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-24 02:04:21 +03:00

lib:talloc: Don't optimize the speed test

If the speed test gets optimized, the malloc() and free() might be
replaced by stack allocations.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
Andreas Schneider 2023-04-17 09:25:48 +02:00 committed by Martin Schwenke
parent b6bf9cba80
commit 00d5982da2

View File

@ -42,6 +42,14 @@
#include "talloc_testsuite.h"
#ifndef disable_optimization
#if __has_attribute(optimize)
#define disable_optimization __attribute__((optimize("O0")))
#else /* disable_optimization */
#define disable_optimization
#endif
#endif /* disable_optimization */
static struct timeval private_timeval_current(void)
{
struct timeval tv;
@ -854,6 +862,7 @@ static bool test_unref_reparent(void)
/*
measure the speed of talloc versus malloc
*/
static bool test_speed(void) disable_optimization;
static bool test_speed(void)
{
void *ctx = talloc_new(NULL);