You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2010/10/30 15:37:13 UTC
svn commit: r1029063 -
/subversion/branches/performance/subversion/libsvn_subr/stream.c
Author: danielsh
Date: Sat Oct 30 13:37:13 2010
New Revision: 1029063
URL: http://svn.apache.org/viewvc?rev=1029063&view=rev
Log:
On the 'performance' branch:
Move a macro definition and consitify a local variable.
* subversion/libsvn_subr/stream.c
(LINE_CHUNK_SIZE):
Define outside of a function's body, since it's used by several functions.
(stream_readline_chunky):
Tell the compiler, not just the reader, that eol_len isn't going to change.
Modified:
subversion/branches/performance/subversion/libsvn_subr/stream.c
Modified: subversion/branches/performance/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/stream.c?rev=1029063&r1=1029062&r2=1029063&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/stream.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/stream.c Sat Oct 30 13:37:13 2010
@@ -274,6 +274,11 @@ scan_eol(const char **eol, svn_stream_t
return SVN_NO_ERROR;
}
+/* Size that 90% of the lines we encounter will be not longer than.
+ used by stream_readline_bytewise() and stream_readline_chunky().
+ */
+#define LINE_CHUNK_SIZE 80
+
/* Guts of svn_stream_readline() and svn_stream_readline_detect_eol().
* Returns the line read from STREAM in *STRINGBUF, and indicates
* end-of-file in *EOF. If DETECT_EOL is TRUE, the end-of-line indicator
@@ -298,8 +303,6 @@ stream_readline_bytewise(svn_stringbuf_t
optimize for the 90% case. 90% of the time, we can avoid the
stringbuf ever having to realloc() itself if we start it out at
80 chars. */
-#define LINE_CHUNK_SIZE 80
-
str = svn_stringbuf_create_ensure(LINE_CHUNK_SIZE, pool);
if (detect_eol)
@@ -369,7 +372,7 @@ stream_readline_chunky(svn_stringbuf_t *
apr_size_t total_parsed = 0;
/* invariant for this call */
- size_t eol_len = strlen(eol);
+ const size_t eol_len = strlen(eol);
/* Remember the line start so this plus the line length will be
* the position to move to at the end of this function.