Re: [PATCH 4/9] vcs-svn: implement perfect hash for top-level keys
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Mar 19, 2011, 08:57 UTC
- Message-ID
- <20110319085737.GC6706@elie>
- In-Reply-To
- <1300518231-20008-5-git-send-email-david.barr@cordelta.com>
David Barr wrote:
Show 14 quoted lines
> --- 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.
[...]
Show 6 quoted lines
> - } 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.