Age | Commit message (Collapse) | Author | Files | Lines |
|
cast_const() et. al. are supposed to be a constant expression, so you can do things like:
static char *p = cast_const(char *, (const char *)"hello");
Unfortunately, a cast to intptr_t and arithmetic makes suncc reject it as
a constant expression. We need the cast, because (1) the expression could be
a void *, so we can't just add to it, and (2) gcc complains with -Wcast-qual
without it.
So instead of adding BUILD_BUG_OR_ZERO, we use a ? :, which keeps everyone happy.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 74859ab18b10aaf990848e49d7789ff5c6cf96c6)
Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Thu Mar 29 08:18:57 CEST 2012 on sn-devel-104
|
|
It still gave a warning on gcc, because casting a char to a char* gives a warning. Not so on sun CC.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 6569a707d169a629e25e10710c760c8dc84525c7)
|
|
OpenBSD doesn't idempotent-wrap sys/mman.h, so when we #define mmap to
an alternative, it fails to compile when sys/mman.h is included again.
Workaround is not to #define mmap to add arguments on Open BSD.
(Imported from CCAN commit e18e80fe175422d26efe689addc0f67bdba0e097)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
CCAN includes a little utility called "namespacize" which prepends ccan_ to
all public methods of a module, and fixes up any dependencies it finds. It's
a little primitive, but it works here.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
This breaks when rlimit is less. Unfortunately, valgrind (32 bit x86,
3.7.0.SVN, Ubuntu) fails to set the file limit properly on the test:
reducing it to the obvious getrlimit/setrlimit/getrlimit works fine,
so leaving diagnostics for another day.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit a85a809bb17af6b6cf6fa31b300c6622f64ee700)
Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Thu Mar 8 06:30:48 CET 2012 on sn-devel-104
|
|
New modules: failtest, list, time, read_write_all and tlist.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
This allows public headers to use CCAN if available, and dummy macros
if not (eg. tdb2).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
Signed-off-by: Martin Schwenke <martin@meltin.net>
Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Thu Dec 15 07:40:33 CET 2011 on sn-devel-104
|
|
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
-Wmissing-field-initializers)
As noted by Jan Engelhardt; libHX fixed this already.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit b2cc1341c9464b6da4654fd3fa0aafe934fba578)
|
|
it means"
Actually, I don't even think it means that. But rename it to something
which is sane.
Thanks to David Gibson for reporting.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit e764d0a27d2b6748ea7d343042ec7d6dda1f6aae)
|
|
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit a8446c3ef94ae0d5f273656da12aa9a8b3abf658)
|
|
Since that has a fixed hash table size and doesn't support delete, we can't
do a thorough comparison, but we can insert and search.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 95757f0e9d979e7c653e9b53bb640deb4f0ea1f9)
|
|
Also general cleanups:
(1) Don't assume that strings are folded by the compiler.
(2) Implement likely_stats_reset().
(3) Return non-const string from likely_stats(), as caller must free it.
(4) Don't use struct info indirection (that was from when we used callbacks?)
(5) Close memory leak in run-debug.c
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 0e5d0e30b30bb07b6605843e5ff224210d8083d8)
|
|
Unfortunately it's a bit of a pain to use for typed hashtables, but it
works.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 60cc720d0797fc49325437ea36a9ffd909c75ed0)
|
|
We change from htable_new()/htable_free() to htable_init/htable_clear.
We also change HTABLE_DEFINE_TYPE() to be the full name, without automatically
prepending htable_.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 0c3590dc33d644f73bb8587db454c491830aaf26)
|
|
There's no real reason to start with 128 entries.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 45f24da35118db441e6153f02f6ddd937da1fa1c)
|
|
This lets us compare hash table vs. strset vs. the example
implementation of critbit trees.
cbspeed 100 runs, min-max(avg):
#01: Initial insert: 236-245(237)
#02: Initial lookup (match): 180-186(180)
#03: Initial lookup (miss): 171-185(172)
#04: Initial lookup (random): 441-457(444)
#05: Initial delete all: 127-132(128)
#06: Initial re-inserting: 219-225(220)
#07: Deleting first half: 101-104(102)
#08: Adding (a different) half: 158-162(159)
#09: Lookup after half-change (match): 202-207(203)
#10: Lookup after half-change (miss): 217-222(218)
#11: Churn 1: 297-302(299)
#12: Churn 2: 297-305(300)
#13: Churn 3: 301-308(303)
#14: Post-Churn lookup (match): 189-195(190)
#15: Post-Churn lookup (miss): 189-193(190)
#16: Post-Churn lookup (random): 499-513(503)
speed 100 runs, min-max(avg):
#01: Initial insert: 211-218(212)
#02: Initial lookup (match): 161-166(162)
#03: Initial lookup (miss): 157-162(158)
#04: Initial lookup (random): 452-460(454)
#05: Initial delete all: 126-135(127)
#06: Initial re-inserting: 193-201(194)
#07: Deleting first half: 99-107(99)
#08: Adding (a different) half: 143-190(144)
#09: Lookup after half-change (match): 183-195(184)
#10: Lookup after half-change (miss): 197-203(198)
#11: Churn 1: 271-278(274)
#12: Churn 2: 280-287(282)
#13: Churn 3: 277-285(279)
#14: Post-Churn lookup (match): 171-175(171)
#15: Post-Churn lookup (miss): 174-178(175)
#16: Post-Churn lookup (random): 525-552(528)
stringspeed 100 runs, min-max(avg):
#01: Initial insert: 300-343(308)
#02: Initial lookup (match): 98-136(99)
#03: Initial lookup (miss): 73-102(75)
#04: Initial lookup (random): 230-282(233)
#05: Initial delete all: 66-102(69)
#06: Initial re-inserting: 62-99(64)
#07: Deleting first half: 43-52(43)
#08: Adding (a different) half: 101-156(106)
#09: Lookup after half-change (match): 114-156(120)
#10: Lookup after half-change (miss): 94-103(95)
#11: Churn 1: 98-105(99)
#12: Churn 2: 96-104(98)
#13: Churn 3: 174-184(176)
#14: Post-Churn lookup (match): 93-112(94)
#15: Post-Churn lookup (miss): 77-107(79)
#16: Post-Churn lookup (random): 229-265(232)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 5c559e7df1d31b4c0ddf26451fac972dc8a0c2c9)
|
|
Firstly, -Wwrite-strings makes string literals const, secondly, we mustn't
define str_strstr etc in terms of themselves!
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 0845e79650c9257aa0ddef8ff99fd815b5edffac)
|
|
LGPL is overkill for trivial wrappers like this.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 942f2788e165bb203b0f160f29bd4592f32dc344)
|
|
documentation.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 12652625db55f6586e95fc5edc73e1e85bae8a5c)
|
|
As pointed out by Christian Thaeter, it has bitrotted.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit f725bbb1987284933e0f21dfb8f2ce7a1f0806e5)
|
|
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit d3d4303acd139e8c34f11067333c000a3f885307)
|
|
It's just a header, I don't care what's done with it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit d06b67d244657da7054e3da580a771c365566d3c)
|
|
We weren't testing for this, and without it, typesafe_cb just casts
its function argument. This is why I didn't get a warning when one of
my patches amended a function incorrectly.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
When we do --enable-tdb2, we start clashing with the replace.h
version:
In file included from ../lib/tdb2/tools/../private.h:25:0,
from ../lib/tdb2/tools/tdb2torture.c:60:
../lib/ccan/likely/likely.h:32:0: warning: "likely" redefined
../lib/replace/replace.h:762:0: note: this is the location of the previous definition
../lib/ccan/likely/likely.h:53:0: warning: "unlikely" redefined
../lib/replace/replace.h:765:0: note: this is the location of the previous definition
I don't like to #ifndef-protect them in general, since you don't want
different parts of the code to silently have different definitions,
but it's the simplest fix for now.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Wed Aug 10 21:12:59 CEST 2011 on sn-devel-104
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This imports licensing clarifications and updates as discussed on
samba-technical ("Subject: Re: ccan code breaks older build farm
systems").
In particular, the recent version have per-file license markers, and
some modules are relicenced more liberally: in particular Simo pointed
out that htable was GPL, and indirectly included by libtdb2, which
would have made that GPL as well.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Mon Jul 25 12:03:40 CEST 2011 on sn-devel-104
|
|
README points out that these code snippets have their own licenses,
and that their home is elsewhere.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
|
|
Michael Adam points out this broke the build farm (ie. OSF1 axp V5.1 2650 alpha)
so fixed in CCAN and imported from af7a902d74a7926693f55da9e21a67dde46931d4:
Turns out it's not standard (thanks Samba build farm!)
And the previous test had a hole in it anyway. This one is more conservative.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Wed Jul 6 08:34:05 CEST 2011 on sn-devel-104
|
|
It's not enough to compile-test them: Michael Adam points out that nonexistant
functions merely cause a warning. We have to try to link them.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Tue Jul 5 07:08:55 CEST 2011 on sn-devel-104
|