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

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

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2007-10-18 00:22:34 CEST

"Charles Acknin" <charlesacknin@gmail.com> writes:

> + SVN_ERR(svn_io_check_path(src_path, &src_kind, pool));
> +
> + if (src_kind == svn_node_none)
> + SVN_ERR(svn_io_copy_file(src_txtb, tmp_wc_text, FALSE, pool));
> + else
> + SVN_ERR(svn_io_copy_file(src_path, tmp_wc_text, TRUE, pool));

As a general rule avoid check-then-operate code. Try the first copy
and if that fails and the error corresponds to a missing file then try
the second copy. That avoids some disk IO and any possibility of a
race.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Oct 18 00:22:57 2007

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.