Author: danielsh
Date: Sat Jul 9 01:09:13 2011
New Revision: 1144565
URL: http://svn.apache.org/viewvc?rev=1144565&view=rev
Log:
On the revprop-packing branch:
Minor optimization.
* subversion/libsvn_fs_fs/fs_fs.c
(set_revision_proplist): Pre-allocate half a KB for the serializes props hash.
Modified:
subversion/branches/revprop-packing/subversion/libsvn_fs_fs/fs_fs.c
subversion/branches/revprop-packing/subversion/libsvn_subr/hash.c
Modified: subversion/branches/revprop-packing/subversion/libsvn_fs_fs/fs_fs.c
URL:
http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_fs_fs/fs_fs.c?rev=1144565&r1=1144564&r2=1144565&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_fs_fs/fs_fs.c
(original)
+++ subversion/branches/revprop-packing/subversion/libsvn_fs_fs/fs_fs.c Sat Jul
9 01:09:13 2011
@@ -3047,7 +3047,7 @@ set_revision_proplist(svn_fs_t *fs,
/* ### We need some locking here, so that folks editing props in the
### same shard don't clobber each other. */
- svn_stringbuf_t *sb = svn_stringbuf_create("", pool);
+ svn_stringbuf_t *sb = svn_stringbuf_create_ensure(512, pool);
svn_stream_t *stream = svn_stream_from_stringbuf(sb, pool);
apr_off_t offset_diff;
apr_off_t old_offset;
Modified: subversion/branches/revprop-packing/subversion/libsvn_subr/hash.c
URL:
http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_subr/hash.c?rev=1144565&r1=1144564&r2=1144565&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_subr/hash.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_subr/hash.c Sat Jul
9 01:09:13 2011
@@ -25,10 +25,12 @@
#include <stdlib.h>
#include <limits.h>
+
#include <apr_version.h>
#include <apr_pools.h>
#include <apr_hash.h>
#include <apr_file_io.h>
+
#include "svn_types.h"
#include "svn_string.h"
#include "svn_error.h"
@@ -36,8 +38,11 @@
#include "svn_sorts.h"
#include "svn_io.h"
#include "svn_pools.h"
+
#include "private/svn_dep_compat.h"
+#include "svn_private_config.h"
+
/*
@@ -106,14 +111,16 @@ hash_read(apr_hash_t *hash, svn_stream_t
/* Check for unexpected end of stream */
if (eof)
- return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, NULL);
+ return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
+ _("Serialized hash missing terminator"));
if ((buf->len >= 3) && (buf->data[0] == 'K') && (buf->data[1] == ' '))
{
/* Get the length of the key */
keylen = (size_t) strtoul(buf->data + 2, &end, 10);
if (keylen == (size_t) ULONG_MAX || *end != '\0')
- return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, NULL);
+ return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
+ _("Serialized hash malformed"));
/* Now read that much into a buffer. */
keybuf = apr_palloc(pool, keylen + 1);
@@ -124,7 +131,8 @@ hash_read(apr_hash_t *hash, svn_stream_t
len = 1;
SVN_ERR(svn_stream_read(stream, &c, &len));
if (c != '\n')
- return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, NULL);
+ return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
+ _("Serialized hash malformed"));
/* Read a val length line */
SVN_ERR(svn_stream_readline(stream, &buf, "\n", &eof, iterpool));
@@ -133,7 +141,8 @@ hash_read(apr_hash_t *hash, svn_stream_t
{
vallen = (size_t) strtoul(buf->data + 2, &end, 10);
if (vallen == (size_t) ULONG_MAX || *end != '\0')
- return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, NULL);
+ return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
+ _("Serialized hash malformed"));
valbuf = apr_palloc(iterpool, vallen + 1);
SVN_ERR(svn_stream_read(stream, valbuf, &vallen));
@@ -143,14 +152,16 @@ hash_read(apr_hash_t *hash, svn_stream_t
len = 1;
SVN_ERR(svn_stream_read(stream, &c, &len));
if (c != '\n')
- return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, NULL);
+ return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
+ _("Serialized hash malformed"));
/* Add a new hash entry. */
apr_hash_set(hash, keybuf, keylen,
svn_string_ncreate(valbuf, vallen, pool));
}
else
- return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, NULL);
+ return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
+ _("Serialized hash malformed"));
}
else if (incremental && (buf->len >= 3)
&& (buf->data[0] == 'D') && (buf->data[1] == ' '))
@@ -158,7 +169,8 @@ hash_read(apr_hash_t *hash, svn_stream_t
/* Get the length of the key */
keylen = (size_t) strtoul(buf->data + 2, &end, 10);
if (keylen == (size_t) ULONG_MAX || *end != '\0')
- return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, NULL);
+ return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
+ _("Serialized hash malformed"));
/* Now read that much into a buffer. */
keybuf = apr_palloc(iterpool, keylen + 1);
@@ -169,14 +181,16 @@ hash_read(apr_hash_t *hash, svn_stream_t
len = 1;
SVN_ERR(svn_stream_read(stream, &c, &len));
if (c != '\n')
- return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, NULL);
+ return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
+ _("Serialized hash malformed"));
/* Remove this hash entry. */
apr_hash_set(hash, keybuf, keylen, NULL);
}
else
{
- return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, NULL);
+ return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL,
+ _("Serialized hash malformed"));
}
}