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

Re: svn commit: r26326 - branches/svnpatch-diff/subversion/libsvn_client

From: David Glasser <glasser_at_davidglasser.net>
Date: 2007-09-08 18:14:12 CEST

On 8/26/07, cacknin@tigris.org <cacknin@tigris.org> wrote:
> Author: cacknin
> Date: Sun Aug 26 08:52:21 2007
> New Revision: 26326
>
> Log:
> * subversion/libsvn_client/patch.c:
> (get_empty_file, merge_file_added): fix cache issue as the empty file
> is moved.
>
>
> Modified:
> branches/svnpatch-diff/subversion/libsvn_client/patch.c
>
> Modified: branches/svnpatch-diff/subversion/libsvn_client/patch.c
> URL: http://svn.collab.net/viewvc/svn/branches/svnpatch-diff/subversion/libsvn_client/patch.c?pathrev=26326&r1=26325&r2=26326
> ==============================================================================
> --- branches/svnpatch-diff/subversion/libsvn_client/patch.c (original)
> +++ branches/svnpatch-diff/subversion/libsvn_client/patch.c Sun Aug 26 08:52:21 2007
> @@ -366,6 +366,11 @@
> SVN_ERR(svn_wc_add_repos_file2(mine, adm_access, yours, NULL,
> new_props, NULL, NULL,
> SVN_IGNORED_REVNUM, subpool));
> + /* The file 'yours' points to edit_baton's cached empty file. Since
> + * it was just moved, set it to empty so that later get_empty_file()
> + * calls don't get it wrong with the cache, i.e. create another
> + * empty file again. */
> + sprintf((char *)yours, ""); /* awful cast */

That strikes me as a strange use of sprintf; how about just
  *yours = '\0';
?

> }
> if (content_state)
> *content_state = svn_wc_notify_state_changed;
> @@ -988,14 +993,13 @@
> get_empty_file(struct edit_baton *eb,
> const char **empty_file_path)
> {
> - /* Create the file if it does not exist */
> + /* Create the file if it does not exist or is empty path. */
> /* Note that we tried to use /dev/null in r17220, but
> that won't work on Windows: it's impossible to stat NUL */
> - if (!eb->empty_file)
> + if (!eb->empty_file || (eb->empty_file && strlen(eb->empty_file) < 1))

Similarly strlen is overkill here, and the short-circuit nature of ||
means you don't need to test empty_file twice::
   if (!eb->empty_file || !*(eb->empty_file))

--dave

-- 
David Glasser | glasser_at_davidglasser.net | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Sep 8 18:10:53 2007

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