[ccan] base64 implementation - feedback requested

Peter Barker pbarker at barker.dropbear.id.au
Tue Aug 19 16:37:03 EST 2014


On Tue, 5 Aug 2014, Rusty Russell wrote:

... stuff, below.  Sorry for the late reply.  Was on a cruise - good! 
Have subsequently had 2 flus - bad!

>> The first branch is an adjustment to ccan/tap; is_str and is_mem
>> implementations giving perl-style, 'expected "foo", got "bar"' errors.
> I'm in two minds about these helpers.  It's hard to get C programmers to
> write tests, so I try to keep the API minimal, even if it means they
> have to write their own helpers.

That's fair enough.

Given the impact of API changes in ccan/tap being conservative is 
absolutely called for.  I've no skin in the game, so moving those helper 
modules into the base64 testing stuff is a no-brainer.

> On the other hand, the improved output is nice.  Yet I usually run my
> tests via ccanlint, which fires up the debugger when one fails which

As just mentioned in a previous email, I didn't actually realise you got 
dropped into a debugger; installing Valgrind fixed that...

... of course, installing Valgrind caused all sorts of complaints in api.c:
 	is_str(base64_decode(NULL,"Zg==",&decoded_length),"f");
(return from base64_decode needs to be freed....)

> lands you straight on the spot.

Sure.  I'd point out that in addition to improved debug, IMHO it also 
makes the tests a little clearer - all subjective, of course.

Many thanks for the feedback.  I'll be working on getting things tidied up 
as David suggested.

> Rusty.

Ta,
-- 
Peter Barker                          |   Programmer,Sysadmin,Geek.
pbarker at barker.dropbear.id.au	      |   You need a bigger hammer.
:: It's a hack! Expect underscores! - Nigel Williams


More information about the ccan mailing list