A C client for memcached

Sean Chittenden sean at chittenden.org
Tue Oct 26 17:56:08 PDT 2004


> I have checked out the code and made a couple of changes to stop
> some compilation errors (gcc 3.3.3 on Fedora2).

Ah, I should've included my CFLAGS, I'm using C99 instead of C89 for my 
compilation.

CFLAGS += -std=c99 -fPIC -g -Wall -Wunused -Wshadow -Wpointer-arith 
-Wbad-function-cast -Wcast-qual -Wcast-align -Ww
rite-strings -Wsign-compare -Waggregate-return -Wstrict-prototypes 
-Wmissing-prototypes -Wmissing-declarations -Wmis
sing-noreturn -Wformat -Wpacked -Wdeprecated-declarations 
-Wredundant-decls -Wnested-externs -Winline -Wdisabled-opt
imization -pipe

> I've also fixed
> a segment violation error (due to allocation and assigning
> members of memcache->live_servers before allocatin the array
> itself).

Excellent find, thanks.  Wonder why I haven't stumbled across that 
yet...

> BTW, what's the reason of expecting '.' instead of ':'
> in the time format returned by the daemon?

Nope... tis intended:

% grep rusage_ memcached.c
         pos += sprintf(pos, "STAT rusage_user %ld.%06ld\r\n", 
usage.ru_utime.tv_sec, usage.ru_utime.tv_usec);
         pos += sprintf(pos, "STAT rusage_system %ld.%06ld\r\n", 
usage.ru_stime.tv_sec, usage.ru_stime.tv_usec);

Unless that slipped in there by accident.  I think the '.' is easier to 
read than a ':', but that could just be me.  Perhaps this is a version 
difference and you're using an old version of memcached that used ':' 
instead?  *shrug*  I'm offline right now otherwise I'd check.  Many of 
those protocol checks can be removed or thrown behind an #ifdef 
PEDANTIC, but I like 'em and think PEDANTIC should be the default... 
bah, now I'm gunna go do it.  Turns out I wasn't doing too much 
superfluous check, but there's an #ifdef PEDANTIC in there (maybe it 
should read #ifdef STRICT or ANAL).

> Please find the patches attached,

Thanks, I've applied them.  In the future, can you please send unified 
diff's?  diff -u.  Makes reading the patches infinitely easier and 
tells patch(1) where to apply the patch.  :)

-sc

-- 
Sean Chittenden



More information about the memcached mailing list