PATCH: code cleanup
Paul Lindner
lindner at inuus.com
Sun Apr 8 15:32:53 UTC 2007
Nice work.
I've applied your patch to the multithreaded branch and also ported it
back to trunk. I also merged in changes 473:486 back to the
multithreaded branch too.
On Thu, Apr 05, 2007 at 05:33:25PM -0500, Tim Yardley 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
--
Paul Lindner ||||| | | | | | | | | |
lindner at inuus.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.danga.com/pipermail/memcached/attachments/20070408/a2a6e2bb/attachment.pgp
More information about the memcached
mailing list