Subject: Re: [PATCH 4/9] vcs-svn: implement perfect hash for top-level keys

From: Jonathan Nieder <[email-masked]>
Date: Sat, 19 Mar 2011 03:57:37 -0500

David Barr wrote:

> --- a/vcs-svn/svndump.c
> +++ b/vcs-svn/svndump.c
> @@ -323,16 +296,25 @@ void svndump_read(const char *url)
>  			continue;
>  		*val++ = '\0';
>  		*val++ = '\0';
> -		key = pool_intern(t);
>  
> -		if (key == keys.svn_fs_dump_format_version) {
> +		/* strlen(key) */
> +		switch (val - t - 2) { 
> +		case 26:
> +			if (memcmp(t, "SVN-fs-dump-format-version", 26))
> +				continue;

Same comments as the previous patch apply here.

Might make sense to split out the loop body (or at least the giant
switch statement) as a separate function for easier contemplation.

[...]
> -		} else if (key == keys.content_length) {
> +			break;
> +		case 14:
> +			if (memcmp(t, "Content-length", 14))
> +				continue;
>  			len = atoi(val);

Thanks for a very clean patch.