Re: [PULL svn-fe] vcs-svn: simplifications, error handling improvements
From: David Barr <hidden>
Date: 2016-06-15 22:50:51
Hi, Junio C Hamano wrote:
Jonathan Nieder [off-list ref] writes:quoted
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.