Author: stefan2
Date: Sat Nov 23 00:09:55 2013
New Revision: 1544716
URL: http://svn.apache.org/r1544716
Log:
* subversion/libsvn_subr/config_file.c
(skip_to_eoln): Newer FSFS config files contain lots of commentary.
Make the parser skip that quickly.
Modified:
subversion/trunk/subversion/libsvn_subr/config_file.c
Modified: subversion/trunk/subversion/libsvn_subr/config_file.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/config_file.c?rev=1544716&r1=1544715&r2=1544716&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/config_file.c (original)
+++ subversion/trunk/subversion/libsvn_subr/config_file.c Sat Nov 23 00:09:55
2013
@@ -185,7 +185,21 @@ skip_to_eoln(parse_context_t *ctx, int *
SVN_ERR(parser_getc(ctx, &ch));
while (ch != '\n' && ch != EOF)
- SVN_ERR(parser_getc_plain(ctx, &ch));
+ {
+ /* This is much faster than checking individual bytes.
+ * We use this function a lot when skipping comment lines. */
+ const char *newline = memchr(ctx->parser_buffer + ctx->buffer_pos,
+ '\n', ctx->buffer_size);
+ if (newline)
+ {
+ ch = '\n';
+ ctx->buffer_pos = newline - ctx->parser_buffer + 1;
+ break;
+ }
+
+ /* refill buffer, check for EOF */
+ SVN_ERR(parser_getc_plain(ctx, &ch));
+ }
*c = ch;
return SVN_NO_ERROR;