From: David Barr Date: Wed, 23 Mar 2011 07:11:25 GMT Subject: Re: [PULL svn-fe] vcs-svn: simplifications, error handling improvements Message-ID: <2DDB3B13-8C13-4F41-BA38-F97C035CBDE8@gmail.com> In-Reply-To: <7vsjuegzj8.fsf@alter.siamese.dyndns.org> Hi, Junio C Hamano wrote: > Jonathan Nieder writes: > >> Please pull >> >> git://repo.or.cz/git/jrn.git svn-fe >> >> to get the following changes on top of master. > > Done. > > I only gave a cursory look at "git diff ORIG_HEAD" output immediately > after pulling, but I found that the majority of lines deleted were of > questionable style and the added ones looked more like normal C ;-) > > Except for > > switch (keylen + 1) { > case sizeof("constant string"): > ... > break; > case sizeof("another constant string"): > ... > } > > which looked a bit unusual. But mistakes in this construct can be easily > caught by the compiler that would notice duplicated case labels, so it > probably is not so brittle as it first looks. Agreed, it is quite an odd construct but it took quite a bit of refinement to arrive there. It is a compromise between moderately readable and reasonably fast. I did play around with perfect hash generators prior to settling on this approach. Ditto re compile time checking. Jonathan, I suppose I should set up a performance test for these patches because my first thought was "I wonder what these buy us on their own?" -- David Barr.