PATCH: code cleanup

rkmr.em at gmail.com rkmr.em at gmail.com
Fri Apr 6 22:51:36 UTC 2007


is this checked in svn or do i need to apply this patch?
thanks


On 4/5/07, Tim Yardley <liquid at haveheart.com> wrote:
>
> All;
>
> Attached is a patch against the multithreaded branch that cleans up
> spacing
> issues bringing the codebase to a hopefully consistent style.  It also
> addresses -Wall warnings, some null checks (a TODO item iirc), and adds
> asserts at the top of each function for any use of conn *c without
> checking
> to see if c is NULL first.
>
> Hopefully those asserts are not necessary as we all write perfect code...
> Right?  Anyway, that conn object is used and passed around enough that it
> should be checked.
>
> Note that there are a couple other areas that could be addressed on an
> optimization level.  I addressed a few like multiple assignments to a
> variable where not needed, elimination of unused variables, value
> assignment
> at initiation where it made sense, #ifdef where a function wont be used,
> etc.
>
> Other things that I noticed that could be addressed but require consensus:
> - optimization of the switch statements to leverage jump tables at
> compilation
> - focusing on popular default cases at the top of the switch to reduce
> comparisons
> - restructing switch statements if necessary to support that under
> different compilers (nesting the switches)
> - visiting the usage of char vs int (byte alignment, powers of two
> padding, etc)
> - inlining some of the smaller functions (candidates would include some of
> the item funtions, etc)
>
>
> A couple of the malloc cases in there looked potentially troubling
> (arbitrary values chosen, and some potential other misallocations) but I
> didn't spend the time to fully analyze them.  Does anyone have access to
> one
> of the commercial source audit applications that would like to run
> memcached
> through it?  If not, would anyone be interested in me persuing that avenue
> with some of the vendors that have offered to run their commercial
> applications on opensource software?
>
> Feedback welcome.
>
> /tmy
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.danga.com/pipermail/memcached/attachments/20070406/42b8ddad/attachment.htm


More information about the memcached mailing list