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

Re: svn commit: rev 834 - trunk/subversion/libsvn_wc

From: Greg Stein <gstein_at_lyra.org>
Date: 2002-01-11 08:46:19 CET

On Thu, Jan 10, 2002 at 11:05:56PM -0600, sussman@tigris.org wrote:
>...
> + else if (style == svn_wc__eol_style_native)
> + {
> + /* Because text-base and working file do not use the same eol
> + style, our only recourse is to convert one of them
> + before comparing. */
> + svn_stringbuf_t *tmp_dir, *tmp_workingfile;
> + apr_file_t *ignored;
> + apr_status_t apr_err;
> +
> + svn_path_split (path, &tmp_dir, &tmp_workingfile,
> + svn_path_local_style, dir_baton->pool);
> +
> + tmp_workingfile = svn_wc__adm_path (tmp_dir, 1, dir_baton->pool,
> + tmp_workingfile, NULL);
> + SVN_ERR (svn_io_open_unique_file (&ignored,
> + &tmp_workingfile,
> + tmp_workingfile,
> + SVN_WC__TMP_EXT,
> + FALSE,
> + dir_baton->pool));
> +
> + /* Toss return value from this, it doesn't matter, we're not
> + writing to this handle anyway. */
> + apr_file_close (ignored);
> +
> + SVN_ERR (svn_io_copy_and_translate (path->data,
> + tmp_workingfile->data,
> + SVN_WC__DEFAULT_EOL_MARKER,
> + 0,
> + "",
> + "",
> + "",
> + "",
> + 0,
> + dir_baton->pool));
> +
> + SVN_ERR (diff_cmd (pristine_copy, tmp_workingfile, path,
> + dir_baton->edit_baton->diff_cmd_baton));
> +
> + apr_err = apr_file_remove (tmp_workingfile->data,
> + dir_baton->pool);
> + if (apr_err)
> + return svn_error_createf
> + (apr_err, 0, NULL, dir_baton->pool,
> + "file_diff: error removing scratch file %s.",
> + tmp_workingfile->data);
> + }

The above block is effectively duplicated twice in this file. I seem to
recall that another checkin (from Karl?) just occurred with basically the
same code. Ah yes... in questions.c.

Let's make a utility function for this.

I would recommend using APR's APR_DELONCLOSE flag for these files so that we
can make sure they go away. That would obviate the need for apr_file_remove
and being careful with exit branches (which Philip noted).

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:56 2006

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.