- 30 Oct, 2014 5 commits
-
-
David Gibson authored
Add a bytestring_bytestring() function which, in analogy with strstr() and memmem() finds one bytestring within another. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-
David Gibson authored
Add bytestring equivalents of the index() and rindex() standard functions which search for characters/bytes within a bytestring. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-
David Gibson authored
This implements bytestring_starts() and bytestring_ends() which will test if a given bytestring starts or ends with another given bytestring. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-
David Gibson authored
Add a bytestring_slice() function to take a sub(byte)string of a bytestring. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-
David Gibson authored
Add a bytestring_byte() function to get a single byte / character from a bytestring. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-
- 27 Oct, 2014 3 commits
-
-
David Gibson authored
The memrchr() function, which works like memchr(), but searches from the back of the region to the front is implemented in the GNU C library, but isn't standard. This patch adds an implementation of the function to the mem module, when it's not available in the system C library. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-
David Gibson authored
Currently the 'mem' module testcases use test/run.c even though they don't rely on access to the module internals. They're also missing an include of mem.c, which has the effect that on systems with a C library memmem() implementaiton, only that is tested, not the (re-)implementation in the mem module itself. This corrects that by moving run.c to api.c/ Additionally, the memmem() testcases don't cover the case where the "needle" appears multiple times in the "haystack". This patch also adds such a test. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-
David Gibson authored
Currently the 'memmem' module does nothing but provide an implementation of the memmem() function if it is missing from the standard C library. However there are other functions (e.g. memrchr()) also missing from some C library implementations, so rename the module to mem to allow future inclusion of other functions. This also updates the rfc822 module - the only existing user of the memmem module - to use the new name. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-
- 25 Oct, 2014 6 commits
-
-
Chris McCormick authored
Syntax highlighting for module example code using prettify. Note: prettify is introduced with an svn checkout into the web directoy.
-
Chris McCormick authored
-
Chris McCormick authored
New page layout, font, background image. Replaced table tags with headers and paragraph tags as appropriate. Redesigned logo. Added stylesheet to specify layout more easily. Meta tag for mobile device friendliness.
-
Chris McCormick authored
-
Chris McCormick authored
-
Chris McCormick authored
-
- 23 Oct, 2014 1 commit
-
-
Chris McCormick authored
Changed the look of the website. Added a new logo design (source SVG included). Fixed an issue with junkcode prefix not being set (broken links and images on current site). Removed /tmp/ccan in clean as it was preventing 'make webpages' running twice. Brought the HTML closer to standards compliance (doctype, encoding). Added meta tag for mobile device browsers to render nicely.
-
- 13 Oct, 2014 7 commits
-
-
Rasmus Villemoes authored
The literal "1" in "1 << (sizeof(long{, long})*8 - 1)" should be 1L or 1LL, so that the expression has the right type. Otherwise, the shift is only by 31 bits on x86 (other platforms may behave differently). To avoid language lawyers shouting UB at me, and since __builtin_ctz{,l,ll} formally takes unsigned parameters, use UL and ULL suffixes. Also, fix a typo (missing parenthesis) in the code for CTZLL causing the detection of __builtin_ctzll to always fail for the wrong reason. Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
Rusty Russell authored
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
David Gibson authored
This adds a new "eratosthenes" module which implements the standard Sieve of Eratosthenes algorithm for locating small prime numbers. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
David Gibson authored
This adds a bitmap_ffs() function to find the first (by the usual bitmap bit ordering) 1 bit in a bitmap between two given bits. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
David Gibson authored
The bitmap module already has a simple allocation helper, which returns an uninitialized, dynamically allocated bitmap of a given size. This extends this with bitmap_alloc[01]() which allocate bitmaps and initialize them to all zero or all one. It also adds bitmap_realloc[01]() which reallocate an existing bitmap, preserving existing bits, and setting any new bits to all zero or all one. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
David Gibson authored
Add bitmap_zero_range() and bitmap_fill_range() functions which will set a contiguous range of bits in the bitmap to 0 or 1. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
David Gibson authored
Currently all bit indices used in the bitmap module are represented as 'int'. These conceptually should be unsigned. In additional limiting these to ints potentially prevents use of very large bitmaps. So, change these all to unsigned long. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
- 13 Sep, 2014 3 commits
-
-
David Gibson authored
This new module provides a simple stack implementation as a singly linked list. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
David Gibson authored
This new module provides a simple queue implementation as a singly linked (circular) list. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
David Gibson authored
It's quite common to have a pointer which could be either a pointer to a structure member, or NULL. This needs special casing with container_of(), or it will convert NULL into something strange. This patch adds container_of_or_null(), which will return NULL if passed (an appropriately typed) NULL, or the containining structure as container_of() otherwise. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
- 27 Aug, 2014 2 commits
-
-
Rusty Russell authored
There seems to be a bug with the overloaded single-linked list. Rewrite. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
Rusty Russell authored
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
- 18 Aug, 2014 4 commits
-
-
Rusty Russell authored
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
Rusty Russell authored
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
Rusty Russell authored
/home/rusty/devel/cvs/ccan/ccan/ccan_tokenizer/test/run.c:898:66: warning: initialization discards ‘const’ qualifier from pointer target type [enabled by default] #define T(txt, ...) {txt, sizeof(txt)-1, array_count_pair(struct token, __VA_ARGS__)} ... Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
Rusty Russell authored
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
- 15 Aug, 2014 1 commit
-
-
Joel Stanley authored
When using the endian swapping marcos with multiple arguments that are or'd together: CPU_TO_BE64(THIS_THING | THAT_THING) gcc will emit this warning: warning: suggest parentheses around arithmetic in operand of ‘|’ [-Wparentheses] Wrap the arugments in braces to avoid this. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
- 12 Aug, 2014 1 commit
-
-
Andy Grover authored
It is useful to be able to remove elements from other than the end, even if it is slow. Signed-off-by: Andy Grover <agrover@redhat.com>
-
- 08 Aug, 2014 2 commits
-
-
Rusty Russell authored
Debugging an issue where pettycoin would become unresponsive, I discovered this: poll([{fd=5, events=POLLIN}, {fd=19, events=POLLIN}, {fd=6, events=POLLIN}, {fd=15, events=POLLIN}, {fd=8, events=POLLIN}, {fd=-11}, {fd=7, events=POLL OUT}], 7, -1) = 1 ([{fd=7, revents=POLLOUT}]) <0.000014> write(7, "\224]\4\0\4\0\0\0\200\203\16\234\v\262\276\321h\357\217Y\0\204\21\31\253\304#U\0206}\20"..., 286100) = 159280 <98.894019> Despite poll saying the (TCP socket) fd was ready, the write took 98 seconds! The results were far more reasonable with O_NONBLOCK: write(9, "%\247l0\337^\216\24\323\2705\203Y\340h\2767/bM\373?dM\254\22g\310\v\0\0\0"..., 206460) = 40544 <0.000052> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
Rusty Russell authored
ccan/io users don't expect to deal with callbacks inside each other; we should just mark woken connections as if they were io_always. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
- 05 Aug, 2014 1 commit
-
-
Rusty Russell authored
During a debugging session, I wondered why poll() wasn't exiting when I killed a (local) peer. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
- 04 Aug, 2014 4 commits
-
-
Rusty Russell authored
This specificity is required, for example, when doing: return io_duplex(conn, io_read(...), io_always(...)); The workaround suggested doesn't work, because io_duplex_prepare() asserts() if the plans aren't UNSET to start. And pettycoin needs this. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
Rusty Russell authored
Helper for a common case. Replace all but 1 in tests. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
Rusty Russell authored
To write a normal helper you only need access to the args, so only expose that. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
Rusty Russell authored
Now a simple flag, with an external toggle (no compile time DEBUG define required). But it's completely synchronous. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-