[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r34449 - trunk/subversion/libsvn_fs_fs

From: David Glasser <glasser_at_davidglasser.net>
Date: Fri, 28 Nov 2008 12:40:14 -0500

On Thu, Nov 27, 2008 at 4:13 PM, <hwright_at_tigris.org> wrote:
> Author: hwright
> Date: Thu Nov 27 13:13:00 2008
> New Revision: 34449
>
> Log:
> A bit of tryptophan-induced hacking: Use a string buf when writing the FSFS
> format file, to enable easy addition of additional options in that file.
>
> * subversion/libsvn_fs_fs/fs_fs.c
> (write_format): Simplify format file content generation.
>
> Modified:
> trunk/subversion/libsvn_fs_fs/fs_fs.c
>
> Modified: trunk/subversion/libsvn_fs_fs/fs_fs.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_fs_fs/fs_fs.c?pathrev=34449&r1=34448&r2=34449
> ==============================================================================
> --- trunk/subversion/libsvn_fs_fs/fs_fs.c Thu Nov 27 01:53:55 2008 (r34448)
> +++ trunk/subversion/libsvn_fs_fs/fs_fs.c Thu Nov 27 13:13:00 2008 (r34449)
> @@ -898,34 +898,31 @@ static svn_error_t *
> write_format(const char *path, int format, int max_files_per_dir,
> svn_boolean_t overwrite, apr_pool_t *pool)
> {
> - const char *contents;
> + svn_stringbuf_t *sb;
> + svn_string_t *contents;
>
> SVN_ERR_ASSERT(1 <= format && format <= SVN_FS_FS__FORMAT_NUMBER);
> +
> + sb = svn_stringbuf_create(apr_psprintf(pool, "%d\n", format), pool);
> +
> if (format >= SVN_FS_FS__MIN_LAYOUT_FORMAT_OPTION_FORMAT)
> {
> if (max_files_per_dir)
> - contents = apr_psprintf(pool,
> - "%d\n"
> - "layout sharded %d\n",
> - format, max_files_per_dir);
> + svn_stringbuf_appendcstr(sb, apr_psprintf(pool, "layout sharded %d\n",
> + max_files_per_dir));
> else
> - contents = apr_psprintf(pool,
> - "%d\n"
> - "layout linear",
> - format);
> - }
> - else
> - {
> - contents = apr_psprintf(pool, "%d\n", format);
> + svn_stringbuf_appendcstr(sb, "layout linear");

Not a regression, but there should probably be a newline here.

--dave

> }
>
> + contents = svn_string_create_from_buf(sb, pool);
> +
> /* svn_io_write_version_file() does a load of magic to allow it to
> replace version files that already exist. We only need to do
> that when we're allowed to overwrite an existing file. */
> if (! overwrite)
> {
> /* Create the file */
> - SVN_ERR(svn_io_file_create(path, contents, pool));
> + SVN_ERR(svn_io_file_create(path, contents->data, pool));
> }
> else
> {
> @@ -933,7 +930,7 @@ write_format(const char *path, int forma
>
> SVN_ERR(svn_io_write_unique(&path_tmp,
> svn_path_dirname(path, pool),
> - contents, strlen(contents),
> + contents->data, contents->len,
> svn_io_file_del_none, pool));
>
> #ifdef WIN32
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: svn-help_at_subversion.tigris.org
>
>

-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-11-28 18:40:37 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.