On Thu, Aug 12, 2010 at 6:27 PM, <stefan2_at_apache.org> wrote:
> Author: stefan2
> Date: Thu Aug 12 23:27:40 2010
> New Revision: 985037
>
> URL: http://svn.apache.org/viewvc?rev=985037&view=rev
> Log:
> The second (and probably last) mass change: svn_stringbuf_appendbytes has
> a relatively large runtime overhead if we only add single bytes - which happens
> frequently in svn's parser codes.
>
> Therefore, add a specialized and simpler variant that takes exactly one character
> and use it in any suitable place.
Instead of introducing a completely new API, what would be the
implications of just checking for the single-byte case inside of
svn_stringbuf_appendbytes(), and calling the more specialized version
in that case?
If we can internally make the decision automatic for API consumers, I
think that's a win.
> * subversion/include/svn_string.h
> (svn_stringbuf_appendbyte): declare this new API function
> * subversion/libsvn_subr/svn_string.c
> (svn_stringbuf_appendbyte): implement the new API function
>
> * subversion/libsvn_client/deprecated.c
> (wrapped_receiver): use new API
> * subversion/libsvn_diff/diff_file.c
> (output_unified_line): dito
> * subversion/libsvn_diff/parse-diff.c
> (parse_hunk_header, hunk_readline): dito
> * subversion/libsvn_fs_fs/lock.c
> (write_digest_file): dito
> * subversion/libsvn_ra_svn/marshal.c
> (read_item): dito
> * subversion/libsvn_repos/dump.c
> (write_hash_to_stringbuf): dito
> * subversion/libsvn_subr/config_file.c
> (parse_value, parse_option, parse_section_name): dito
> * subversion/libsvn_subr/prompt.c
> (prompt): dito
> * subversion/libsvn_subr/quoprint.c
> (encode_bytes, decode_bytes): dito
> * subversion/libsvn_subr/skel.c
> (unparse): dito
> * subversion/libsvn_subr/stream.c
> (stream_readline): dito
> * subversion/libsvn_subr/subst.c
> (keyword_printf): dito
> * subversion/libsvn_wc/old-and-busted.c
> (read_str): dito
> * subversion/libsvn_wc/props.c
> (svn_wc_canonicalize_svn_prop): dito
> * subversion/svn/util.c
> (svn_cl__get_log_message): dito
> * subversion/svndumpfilter/main.c
> (write_prop_to_stringbuf, output_revision, output_node): dito
> * subversion/tests/libsvn_subr/skel-test.c
> (put_implicit_length_byte, put_implicit_length_all_chars, put_list_start, put_list_end): dito
> * subversion/tests/libsvn_subr/stream-test.c
> (generate_test_bytes): dito
>
> Modified:
> subversion/branches/performance/subversion/include/svn_string.h
> subversion/branches/performance/subversion/libsvn_client/deprecated.c
> subversion/branches/performance/subversion/libsvn_diff/diff_file.c
> subversion/branches/performance/subversion/libsvn_diff/parse-diff.c
> subversion/branches/performance/subversion/libsvn_fs_fs/lock.c
> subversion/branches/performance/subversion/libsvn_ra_svn/marshal.c
> subversion/branches/performance/subversion/libsvn_repos/dump.c
> subversion/branches/performance/subversion/libsvn_subr/config_file.c
> subversion/branches/performance/subversion/libsvn_subr/prompt.c
> subversion/branches/performance/subversion/libsvn_subr/quoprint.c
> subversion/branches/performance/subversion/libsvn_subr/skel.c
> subversion/branches/performance/subversion/libsvn_subr/stream.c
> subversion/branches/performance/subversion/libsvn_subr/subst.c
> subversion/branches/performance/subversion/libsvn_subr/svn_string.c
> subversion/branches/performance/subversion/libsvn_wc/old-and-busted.c
> subversion/branches/performance/subversion/libsvn_wc/props.c
> subversion/branches/performance/subversion/svn/util.c
> subversion/branches/performance/subversion/svndumpfilter/main.c
> subversion/branches/performance/subversion/tests/libsvn_subr/skel-test.c
> subversion/branches/performance/subversion/tests/libsvn_subr/stream-test.c
>
> Modified: subversion/branches/performance/subversion/include/svn_string.h
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/include/svn_string.h?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/include/svn_string.h (original)
> +++ subversion/branches/performance/subversion/include/svn_string.h Thu Aug 12 23:27:40 2010
> @@ -253,6 +253,15 @@ svn_stringbuf_chop(svn_stringbuf_t *str,
> void
> svn_stringbuf_fillchar(svn_stringbuf_t *str, unsigned char c);
>
> +/** Append a single character @a byte onto @a targetstr.
> + *
> + * reallocs if necessary. @a targetstr is affected, nothing else is.
> + * @since New in 1.7.
> + */
> +void
> +svn_stringbuf_appendbyte(svn_stringbuf_t *targetstr,
> + char byte);
> +
> /** Append an array of bytes onto @a targetstr.
> *
> * reallocs if necessary. @a targetstr is affected, nothing else is.
>
> Modified: subversion/branches/performance/subversion/libsvn_client/deprecated.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_client/deprecated.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/libsvn_client/deprecated.c (original)
> +++ subversion/branches/performance/subversion/libsvn_client/deprecated.c Thu Aug 12 23:27:40 2010
> @@ -279,7 +279,7 @@ wrapped_receiver(void *baton,
> struct wrapped_receiver_baton_s *b = baton;
> svn_stringbuf_t *expanded_line = svn_stringbuf_create(line, pool);
>
> - svn_stringbuf_appendbytes(expanded_line, "\r", 1);
> + svn_stringbuf_appendbyte(expanded_line, '\r');
>
> return b->orig_receiver(b->orig_baton, line_no, revision, author,
> date, expanded_line->data, pool);
>
> Modified: subversion/branches/performance/subversion/libsvn_diff/diff_file.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_diff/diff_file.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/libsvn_diff/diff_file.c (original)
> +++ subversion/branches/performance/subversion/libsvn_diff/diff_file.c Thu Aug 12 23:27:40 2010
> @@ -860,7 +860,7 @@ output_unified_line(svn_diff__file_outpu
> {
> if (type != svn_diff__file_output_unified_skip)
> {
> - svn_stringbuf_appendbytes(baton->hunk, curp, 1);
> + svn_stringbuf_appendbyte(baton->hunk, *curp);
> }
> /* We don't append the LF to extra_context, since it would
> * just be stripped anyway. */
>
> Modified: subversion/branches/performance/subversion/libsvn_diff/parse-diff.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_diff/parse-diff.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/libsvn_diff/parse-diff.c (original)
> +++ subversion/branches/performance/subversion/libsvn_diff/parse-diff.c Thu Aug 12 23:27:40 2010
> @@ -201,7 +201,7 @@ parse_hunk_header(const char *header, sv
> p++;
> while (*p && *p != ' ')
> {
> - svn_stringbuf_appendbytes(range, p, 1);
> + svn_stringbuf_appendbyte(range, *p);
> p++;
> }
> if (*p != ' ')
> @@ -230,7 +230,7 @@ parse_hunk_header(const char *header, sv
> p++;
> while (*p && *p != ' ')
> {
> - svn_stringbuf_appendbytes(range, p, 1);
> + svn_stringbuf_appendbyte(range, *p);
> p++;
> }
> if (*p != ' ')
> @@ -374,7 +374,7 @@ hunk_readline(svn_stream_t *stream,
> else
> match = eol_str;
>
> - svn_stringbuf_appendbytes(str, &c, 1);
> + svn_stringbuf_appendbyte(str, c);
> }
>
> svn_stringbuf_chop(str, match - eol_str);
>
> Modified: subversion/branches/performance/subversion/libsvn_fs_fs/lock.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_fs_fs/lock.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/libsvn_fs_fs/lock.c (original)
> +++ subversion/branches/performance/subversion/libsvn_fs_fs/lock.c Thu Aug 12 23:27:40 2010
> @@ -192,7 +192,7 @@ write_digest_file(apr_hash_t *children,
> svn_stringbuf_appendbytes(children_list,
> svn__apr_hash_index_key(hi),
> svn__apr_hash_index_klen(hi));
> - svn_stringbuf_appendbytes(children_list, "\n", 1);
> + svn_stringbuf_appendbyte(children_list, '\n');
> }
> hash_store(hash, CHILDREN_KEY, sizeof(CHILDREN_KEY)-1,
> children_list->data, children_list->len, pool);
>
> Modified: subversion/branches/performance/subversion/libsvn_ra_svn/marshal.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_ra_svn/marshal.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/libsvn_ra_svn/marshal.c (original)
> +++ subversion/branches/performance/subversion/libsvn_ra_svn/marshal.c Thu Aug 12 23:27:40 2010
> @@ -649,7 +649,7 @@ static svn_error_t *read_item(svn_ra_svn
> SVN_ERR(readbuf_getchar(conn, pool, &c));
> if (!svn_ctype_isalnum(c) && c != '-')
> break;
> - svn_stringbuf_appendbytes(str, &c, 1);
> + svn_stringbuf_appendbyte(str, c);
> }
> item->kind = SVN_RA_SVN_WORD;
> item->u.word = str->data;
>
> Modified: subversion/branches/performance/subversion/libsvn_repos/dump.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_repos/dump.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/libsvn_repos/dump.c (original)
> +++ subversion/branches/performance/subversion/libsvn_repos/dump.c Thu Aug 12 23:27:40 2010
> @@ -84,7 +84,7 @@ write_hash_to_stringbuf(apr_hash_t *hash
> keylen));
>
> svn_stringbuf_appendbytes(*strbuf, (const char *) key, keylen);
> - svn_stringbuf_appendbytes(*strbuf, "\n", 1);
> + svn_stringbuf_appendbyte(*strbuf, '\n');
>
> /* Output value length, then value. */
>
> @@ -93,7 +93,7 @@ write_hash_to_stringbuf(apr_hash_t *hash
> value->len));
>
> svn_stringbuf_appendbytes(*strbuf, value->data, value->len);
> - svn_stringbuf_appendbytes(*strbuf, "\n", 1);
> + svn_stringbuf_appendbyte(*strbuf, '\n');
> }
>
> if (oldhash)
> @@ -120,7 +120,7 @@ write_hash_to_stringbuf(apr_hash_t *hash
> keylen));
>
> svn_stringbuf_appendbytes(*strbuf, (const char *) key, keylen);
> - svn_stringbuf_appendbytes(*strbuf, "\n", 1);
> + svn_stringbuf_appendbyte(*strbuf, '\n');
> }
> }
> svn_stringbuf_appendbytes(*strbuf, "PROPS-END\n", 10);
>
> Modified: subversion/branches/performance/subversion/libsvn_subr/config_file.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/config_file.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/libsvn_subr/config_file.c (original)
> +++ subversion/branches/performance/subversion/libsvn_subr/config_file.c Thu Aug 12 23:27:40 2010
> @@ -163,7 +163,7 @@ parse_value(int *pch, parse_context_t *c
> /* last ch seen was ':' or '=' in parse_option. */
> {
> const char char_from_int = ch;
> - svn_stringbuf_appendbytes(ctx->value, &char_from_int, 1);
> + svn_stringbuf_appendbyte(ctx->value, char_from_int);
> SVN_ERR(parser_getc(ctx, &ch));
> }
> /* Leading and trailing whitespace is ignored. */
> @@ -214,13 +214,12 @@ parse_value(int *pch, parse_context_t *c
> else
> {
> /* This is a continuation line. Read it. */
> - svn_stringbuf_appendbytes(ctx->value, " ", 1);
> + svn_stringbuf_appendbyte(ctx->value, ' ');
>
> while (ch != EOF && ch != '\n')
> {
> const char char_from_int = ch;
> - svn_stringbuf_appendbytes(ctx->value,
> - &char_from_int, 1);
> + svn_stringbuf_appendbyte(ctx->value, char_from_int);
> SVN_ERR(parser_getc(ctx, &ch));
> }
> /* Trailing whitespace is ignored. */
> @@ -247,7 +246,7 @@ parse_option(int *pch, parse_context_t *
> while (ch != EOF && ch != ':' && ch != '=' && ch != '\n')
> {
> const char char_from_int = ch;
> - svn_stringbuf_appendbytes(ctx->option, &char_from_int, 1);
> + svn_stringbuf_appendbyte(ctx->option, char_from_int);
> SVN_ERR(parser_getc(ctx, &ch));
> }
>
> @@ -290,7 +289,7 @@ parse_section_name(int *pch, parse_conte
> while (ch != EOF && ch != ']' && ch != '\n')
> {
> const char char_from_int = ch;
> - svn_stringbuf_appendbytes(ctx->section, &char_from_int, 1);
> + svn_stringbuf_appendbyte(ctx->section, char_from_int);
> SVN_ERR(parser_getc(ctx, &ch));
> }
>
>
> Modified: subversion/branches/performance/subversion/libsvn_subr/prompt.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/prompt.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/libsvn_subr/prompt.c (original)
> +++ subversion/branches/performance/subversion/libsvn_subr/prompt.c Thu Aug 12 23:27:40 2010
> @@ -147,7 +147,7 @@ prompt(const char **result,
> SVN_ERR_MALFUNCTION();
> }
>
> - svn_stringbuf_appendbytes(strbuf, &c, 1);
> + svn_stringbuf_appendbyte(strbuf, c);
> }
> }
> else
>
> Modified: subversion/branches/performance/subversion/libsvn_subr/quoprint.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/quoprint.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/libsvn_subr/quoprint.c (original)
> +++ subversion/branches/performance/subversion/libsvn_subr/quoprint.c Thu Aug 12 23:27:40 2010
> @@ -92,7 +92,7 @@ encode_bytes(svn_stringbuf_t *str, const
> /* Encode this character. */
> if (ENCODE_AS_LITERAL(*p))
> {
> - svn_stringbuf_appendbytes(str, p, 1);
> + svn_stringbuf_appendbyte(str, *p);
> (*linelen)++;
> }
> else
> @@ -218,7 +218,7 @@ decode_bytes(svn_stringbuf_t *str, const
> {
> /* Literal character; append it if it's valid as such. */
> if (VALID_LITERAL(*inbuf))
> - svn_stringbuf_appendbytes(str, inbuf, 1);
> + svn_stringbuf_appendbyte(str, *inbuf);
> *inbuflen = 0;
> }
> else if (*inbuf == '=' && *inbuflen == 2 && inbuf[1] == '\n')
> @@ -234,7 +234,7 @@ decode_bytes(svn_stringbuf_t *str, const
> if (find1 != NULL && find2 != NULL)
> {
> c = ((find1 - hextab) << 4) | (find2 - hextab);
> - svn_stringbuf_appendbytes(str, &c, 1);
> + svn_stringbuf_appendbyte(str, c);
> }
> *inbuflen = 0;
> }
>
> Modified: subversion/branches/performance/subversion/libsvn_subr/skel.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/skel.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/libsvn_subr/skel.c (original)
> +++ subversion/branches/performance/subversion/libsvn_subr/skel.c Thu Aug 12 23:27:40 2010
> @@ -535,7 +535,7 @@ unparse(const svn_skel_t *skel, svn_stri
> }
>
> /* Emit a closing parenthesis. */
> - svn_stringbuf_appendbytes(str, ")", 1);
> + svn_stringbuf_appendbyte(str, ')');
> }
>
> return str;
>
> Modified: subversion/branches/performance/subversion/libsvn_subr/stream.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/stream.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/libsvn_subr/stream.c (original)
> +++ subversion/branches/performance/subversion/libsvn_subr/stream.c Thu Aug 12 23:27:40 2010
> @@ -306,7 +306,7 @@ stream_readline(svn_stringbuf_t **string
> else
> match = eol_str;
>
> - svn_stringbuf_appendbytes(str, &c, 1);
> + svn_stringbuf_appendbyte(str, c);
> }
>
> *eof = FALSE;
>
> Modified: subversion/branches/performance/subversion/libsvn_subr/subst.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/subst.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/libsvn_subr/subst.c (original)
> +++ subversion/branches/performance/subversion/libsvn_subr/subst.c Thu Aug 12 23:27:40 2010
> @@ -211,10 +211,10 @@ keyword_printf(const char *fmt,
> svn_stringbuf_appendcstr(value, url);
> break;
> case '%': /* '%%' => a literal % */
> - svn_stringbuf_appendbytes(value, cur, 1);
> + svn_stringbuf_appendbyte(value, *cur);
> break;
> case '\0': /* '%' as the last character of the string. */
> - svn_stringbuf_appendbytes(value, cur, 1);
> + svn_stringbuf_appendbyte(value, *cur);
> /* Now go back one character, since this was just a one character
> * sequence, whereas all others are two characters, and we do not
> * want to skip the null terminator entirely and carry on
>
> Modified: subversion/branches/performance/subversion/libsvn_subr/svn_string.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/svn_string.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/libsvn_subr/svn_string.c (original)
> +++ subversion/branches/performance/subversion/libsvn_subr/svn_string.c Thu Aug 12 23:27:40 2010
> @@ -385,6 +385,30 @@ svn_stringbuf_ensure(svn_stringbuf_t *st
>
>
> void
> +svn_stringbuf_appendbyte(svn_stringbuf_t *str, char byte)
> +{
> + /* In most cases, there will be pre-allocated memory left
> + * to just write the new byte at the end of the used section
> + * and terminate the string properly.
> + */
> + apr_size_t old_len = str->len;
> + if (str->blocksize > old_len + 1)
> + {
> + str->data[old_len] = byte;
> + str->data[old_len+1] = '\0';
> + str->len = old_len+1;
> + }
> + else
> + {
> + /* we need to re-allocate the string buffer
> + * -> let the more generic implementation take care of that part
> + */
> + svn_stringbuf_appendbytes(str, &byte, 1);
> + }
> +}
> +
> +
> +void
> svn_stringbuf_appendbytes(svn_stringbuf_t *str, const char *bytes,
> apr_size_t count)
> {
>
> Modified: subversion/branches/performance/subversion/libsvn_wc/old-and-busted.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/old-and-busted.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/libsvn_wc/old-and-busted.c (original)
> +++ subversion/branches/performance/subversion/libsvn_wc/old-and-busted.c Thu Aug 12 23:27:40 2010
> @@ -164,7 +164,7 @@ read_str(const char **result,
> svn_stringbuf_appendbytes(s, start, *buf - start);
> (*buf)++;
> SVN_ERR(read_escaped(&c, buf, end));
> - svn_stringbuf_appendbytes(s, &c, 1);
> + svn_stringbuf_appendbyte(s, c);
> start = *buf;
> }
> else
>
> Modified: subversion/branches/performance/subversion/libsvn_wc/props.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/props.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/libsvn_wc/props.c (original)
> +++ subversion/branches/performance/subversion/libsvn_wc/props.c Thu Aug 12 23:27:40 2010
> @@ -2632,7 +2632,7 @@ svn_wc_canonicalize_svn_prop(const svn_s
> if (propval->data[propval->len - 1] != '\n')
> {
> new_value = svn_stringbuf_create_from_string(propval, pool);
> - svn_stringbuf_appendbytes(new_value, "\n", 1);
> + svn_stringbuf_appendbyte(new_value, '\n');
> }
>
> /* Make sure this is a valid externals property. Do not
>
> Modified: subversion/branches/performance/subversion/svn/util.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/svn/util.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/svn/util.c (original)
> +++ subversion/branches/performance/subversion/svn/util.c Thu Aug 12 23:27:40 2010
> @@ -763,9 +763,9 @@ svn_cl__get_log_message(const char **log
> && item->state_flags & SVN_CLIENT_COMMIT_ITEM_LOCK_TOKEN)
> unlock = 'U';
>
> - svn_stringbuf_appendbytes(tmp_message, &text_mod, 1);
> - svn_stringbuf_appendbytes(tmp_message, &prop_mod, 1);
> - svn_stringbuf_appendbytes(tmp_message, &unlock, 1);
> + svn_stringbuf_appendbyte(tmp_message, text_mod);
> + svn_stringbuf_appendbyte(tmp_message, prop_mod);
> + svn_stringbuf_appendbyte(tmp_message, unlock);
> if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_IS_COPY)
> /* History included via copy/move. */
> svn_stringbuf_appendcstr(tmp_message, "+ ");
>
> Modified: subversion/branches/performance/subversion/svndumpfilter/main.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/svndumpfilter/main.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/svndumpfilter/main.c (original)
> +++ subversion/branches/performance/subversion/svndumpfilter/main.c Thu Aug 12 23:27:40 2010
> @@ -91,20 +91,20 @@ write_prop_to_stringbuf(svn_stringbuf_t
>
> bytes_used = apr_snprintf(buf, sizeof(buf), "%d", namelen);
> svn_stringbuf_appendbytes(*strbuf, buf, bytes_used);
> - svn_stringbuf_appendbytes(*strbuf, "\n", 1);
> + svn_stringbuf_appendbyte(*strbuf, '\n');
>
> svn_stringbuf_appendbytes(*strbuf, name, namelen);
> - svn_stringbuf_appendbytes(*strbuf, "\n", 1);
> + svn_stringbuf_appendbyte(*strbuf, '\n');
>
> /* Output value length, then value. */
> svn_stringbuf_appendbytes(*strbuf, "V ", 2);
>
> bytes_used = apr_snprintf(buf, sizeof(buf), "%" APR_SIZE_T_FMT, value->len);
> svn_stringbuf_appendbytes(*strbuf, buf, bytes_used);
> - svn_stringbuf_appendbytes(*strbuf, "\n", 1);
> + svn_stringbuf_appendbyte(*strbuf, '\n');
>
> svn_stringbuf_appendbytes(*strbuf, value->data, value->len);
> - svn_stringbuf_appendbytes(*strbuf, "\n", 1);
> + svn_stringbuf_appendbyte(*strbuf, '\n');
> }
>
>
> @@ -365,19 +365,19 @@ output_revision(struct revision_baton_t
> bytes_used = apr_snprintf(buf, sizeof(buf), ": %" APR_SIZE_T_FMT,
> props->len);
> svn_stringbuf_appendbytes(rb->header, buf, bytes_used);
> - svn_stringbuf_appendbytes(rb->header, "\n", 1);
> + svn_stringbuf_appendbyte(rb->header, '\n');
> }
>
> svn_stringbuf_appendcstr(rb->header, SVN_REPOS_DUMPFILE_CONTENT_LENGTH);
> bytes_used = apr_snprintf(buf, sizeof(buf), ": %" APR_SIZE_T_FMT, props->len);
> svn_stringbuf_appendbytes(rb->header, buf, bytes_used);
> - svn_stringbuf_appendbytes(rb->header, "\n", 1);
> + svn_stringbuf_appendbyte(rb->header, '\n');
>
> /* put an end to headers */
> - svn_stringbuf_appendbytes(rb->header, "\n", 1);
> + svn_stringbuf_appendbyte(rb->header, '\n');
>
> /* put an end to revision */
> - svn_stringbuf_appendbytes(props, "\n", 1);
> + svn_stringbuf_appendbyte(props, '\n');
>
> /* write out the revision */
> /* Revision is written out in the following cases:
> @@ -633,7 +633,7 @@ output_node(struct node_baton_t *nb)
> bytes_used = apr_snprintf(buf, sizeof(buf), ": %" APR_SIZE_T_FMT,
> nb->props->len);
> svn_stringbuf_appendbytes(nb->header, buf, bytes_used);
> - svn_stringbuf_appendbytes(nb->header, "\n", 1);
> + svn_stringbuf_appendbyte(nb->header, '\n');
> }
> if (nb->has_text)
> {
> @@ -642,16 +642,16 @@ output_node(struct node_baton_t *nb)
> bytes_used = apr_snprintf(buf, sizeof(buf), ": %" SVN_FILESIZE_T_FMT,
> nb->tcl);
> svn_stringbuf_appendbytes(nb->header, buf, bytes_used);
> - svn_stringbuf_appendbytes(nb->header, "\n", 1);
> + svn_stringbuf_appendbyte(nb->header, '\n');
> }
> svn_stringbuf_appendcstr(nb->header, SVN_REPOS_DUMPFILE_CONTENT_LENGTH);
> bytes_used = apr_snprintf(buf, sizeof(buf), ": %" SVN_FILESIZE_T_FMT,
> (svn_filesize_t) (nb->props->len + nb->tcl));
> svn_stringbuf_appendbytes(nb->header, buf, bytes_used);
> - svn_stringbuf_appendbytes(nb->header, "\n", 1);
> + svn_stringbuf_appendbyte(nb->header, '\n');
>
> /* put an end to headers */
> - svn_stringbuf_appendbytes(nb->header, "\n", 1);
> + svn_stringbuf_appendbyte(nb->header, '\n');
>
> /* 3. output all the stuff */
>
>
> Modified: subversion/branches/performance/subversion/tests/libsvn_subr/skel-test.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/tests/libsvn_subr/skel-test.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/tests/libsvn_subr/skel-test.c (original)
> +++ subversion/branches/performance/subversion/tests/libsvn_subr/skel-test.c Thu Aug 12 23:27:40 2010
> @@ -184,9 +184,9 @@ put_implicit_length_byte(svn_stringbuf_t
> && ! skel_is_space(term)
> && ! skel_is_paren(term))
> abort();
> - svn_stringbuf_appendbytes(str, &byte, 1);
> + svn_stringbuf_appendbyte(str, byte);
> if (term != '\0')
> - svn_stringbuf_appendbytes(str, &term, 1);
> + svn_stringbuf_appendbyte(str, term);
> }
>
>
> @@ -239,7 +239,7 @@ put_implicit_length_all_chars(svn_string
>
> svn_stringbuf_appendbytes(str, name, len);
> if (term != '\0')
> - svn_stringbuf_appendbytes(str, &term, 1);
> + svn_stringbuf_appendbyte(str, term);
> }
>
>
> @@ -461,7 +461,7 @@ put_list_start(svn_stringbuf_t *str, cha
>
> svn_stringbuf_appendcstr(str, "(");
> for (i = 0; i < len; i++)
> - svn_stringbuf_appendbytes(str, &space, 1);
> + svn_stringbuf_appendbyte(str, space);
> }
>
>
> @@ -476,7 +476,7 @@ put_list_end(svn_stringbuf_t *str, char
> abort();
>
> for (i = 0; i < len; i++)
> - svn_stringbuf_appendbytes(str, &space, 1);
> + svn_stringbuf_appendbyte(str, space);
> svn_stringbuf_appendcstr(str, ")");
> }
>
>
> Modified: subversion/branches/performance/subversion/tests/libsvn_subr/stream-test.c
> URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/tests/libsvn_subr/stream-test.c?rev=985037&r1=985036&r2=985037&view=diff
> ==============================================================================
> --- subversion/branches/performance/subversion/tests/libsvn_subr/stream-test.c (original)
> +++ subversion/branches/performance/subversion/tests/libsvn_subr/stream-test.c Thu Aug 12 23:27:40 2010
> @@ -128,7 +128,7 @@ generate_test_bytes(int num_bytes, apr_p
>
> for (total = 0, repeat = repeat_iter = 1, c = 0; total < num_bytes; total++)
> {
> - svn_stringbuf_appendbytes(buffer, &c, 1);
> + svn_stringbuf_appendbytes(buffer, c);
>
> repeat_iter--;
> if (repeat_iter == 0)
>
>
>
Received on 2010-09-09 19:39:34 CEST