summaryrefslogtreecommitdiff
path: root/lib/talloc
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2016-06-01 15:42:13 +0200
committerVolker Lendecke <vl@samba.org>2016-06-01 21:09:16 +0200
commite8c9e10dbbc585f346a4159b75fcc024cfe1c01a (patch)
treeed7133b96a297e0364d20982e1ce9d10fc24be8d /lib/talloc
parentf8141e91a693912ea1107a49320e83702a80757a (diff)
downloadsamba-e8c9e10dbbc585f346a4159b75fcc024cfe1c01a.tar.gz
talloc: rename local timeval function copies
timeval_current() and timeval_elapsed() are public functions from libsamba-util. Redeclaring them as static functions here triggers linker error when building with gcc link-time-optimisation (LTO). This shows the error after reverting this patch: [slow@kazak lto]$ make -j WAF_MAKE=1 python ./buildtools/bin/waf build Waf: Entering directory `/home/slow/git/samba/lto/bin' Selected embedded Heimdal build [ 174/4259] Generating ctdb-samba-version-header [ 174/4259] Generating ctdb-samba-version-header [ 521/4259] Generating source4/torture/local/proto.h [2565/4259] Compiling lib/talloc/testsuite.c [4125/4259] Linking default/source4/torture/smbtorture /tmp/ccvL9UCe.ltrans3.ltrans.o:<artificial>:function smbsrv_accept.lto_priv.11: error: undefined reference to 'timeval_current.lto_priv.630' /tmp/ccvL9UCe.ltrans4.ltrans.o:<artificial>:function smbsrv_recv_smb2_request: error: undefined reference to 'timeval_current.lto_priv.630' /tmp/ccvL9UCe.ltrans4.ltrans.o:<artificial>:function smb2srv_negprot_backend: error: undefined reference to 'timeval_current.lto_priv.630' /tmp/ccvL9UCe.ltrans4.ltrans.o:<artificial>:function smb2srv_negprot_backend: error: undefined reference to 'timeval_current.lto_priv.630' /tmp/ccvL9UCe.ltrans9.ltrans.o:<artificial>:function test_smb2_oplock_batch22: error: undefined reference to 'timeval_elapsed.lto_priv.628' /tmp/ccvL9UCe.ltrans9.ltrans.o:<artificial>:function test_smb2_bench_oplock: error: undefined reference to 'timeval_elapsed.lto_priv.628' /tmp/ccvL9UCe.ltrans9.ltrans.o:<artificial>:function test_smb2_bench_oplock: error: undefined reference to 'timeval_elapsed.lto_priv.628' /tmp/ccvL9UCe.ltrans9.ltrans.o:<artificial>:function test_smb2_bench_oplock: error: undefined reference to 'timeval_elapsed.lto_priv.628' collect2: error: ld returned 1 exit status ... Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Wed Jun 1 21:09:16 CEST 2016 on sn-devel-144
Diffstat (limited to 'lib/talloc')
-rw-r--r--lib/talloc/testsuite.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/talloc/testsuite.c b/lib/talloc/testsuite.c
index 5eab839f51d..dd49df1f982 100644
--- a/lib/talloc/testsuite.c
+++ b/lib/talloc/testsuite.c
@@ -36,16 +36,16 @@
#include "talloc_testsuite.h"
-static struct timeval timeval_current(void)
+static struct timeval private_timeval_current(void)
{
struct timeval tv;
gettimeofday(&tv, NULL);
return tv;
}
-static double timeval_elapsed(struct timeval *tv)
+static double private_timeval_elapsed(struct timeval *tv)
{
- struct timeval tv2 = timeval_current();
+ struct timeval tv2 = private_timeval_current();
return (tv2.tv_sec - tv->tv_sec) +
(tv2.tv_usec - tv->tv_usec)*1.0e-6;
}
@@ -835,7 +835,7 @@ static bool test_speed(void)
printf("test: speed\n# TALLOC VS MALLOC SPEED\n");
- tv = timeval_current();
+ tv = private_timeval_current();
count = 0;
do {
void *p1, *p2, *p3;
@@ -848,15 +848,15 @@ static bool test_speed(void)
talloc_free(p1);
}
count += 3 * loop;
- } while (timeval_elapsed(&tv) < 5.0);
+ } while (private_timeval_elapsed(&tv) < 5.0);
- fprintf(stderr, "talloc: %.0f ops/sec\n", count/timeval_elapsed(&tv));
+ fprintf(stderr, "talloc: %.0f ops/sec\n", count/private_timeval_elapsed(&tv));
talloc_free(ctx);
ctx = talloc_pool(NULL, 1024);
- tv = timeval_current();
+ tv = private_timeval_current();
count = 0;
do {
void *p1, *p2, *p3;
@@ -869,13 +869,13 @@ static bool test_speed(void)
talloc_free(p1);
}
count += 3 * loop;
- } while (timeval_elapsed(&tv) < 5.0);
+ } while (private_timeval_elapsed(&tv) < 5.0);
talloc_free(ctx);
- fprintf(stderr, "talloc_pool: %.0f ops/sec\n", count/timeval_elapsed(&tv));
+ fprintf(stderr, "talloc_pool: %.0f ops/sec\n", count/private_timeval_elapsed(&tv));
- tv = timeval_current();
+ tv = private_timeval_current();
count = 0;
do {
void *p1, *p2, *p3;
@@ -888,8 +888,8 @@ static bool test_speed(void)
free(p3);
}
count += 3 * loop;
- } while (timeval_elapsed(&tv) < 5.0);
- fprintf(stderr, "malloc: %.0f ops/sec\n", count/timeval_elapsed(&tv));
+ } while (private_timeval_elapsed(&tv) < 5.0);
+ fprintf(stderr, "malloc: %.0f ops/sec\n", count/private_timeval_elapsed(&tv));
printf("success: speed\n");