Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A8DCF11EAC for ; Fri, 22 Aug 2014 10:00:28 +0000 (UTC) Received: (qmail 39468 invoked by uid 500); 22 Aug 2014 10:00:28 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 39439 invoked by uid 500); 22 Aug 2014 10:00:28 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 39429 invoked by uid 99); 22 Aug 2014 10:00:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Aug 2014 10:00:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Aug 2014 10:00:06 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 3C3D62388C29; Fri, 22 Aug 2014 10:00:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1619726 - /subversion/trunk/subversion/tests/libsvn_subr/translate-test.c Date: Fri, 22 Aug 2014 10:00:04 -0000 To: commits@subversion.apache.org From: rhuijben@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140822100004.3C3D62388C29@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rhuijben Date: Fri Aug 22 10:00:03 2014 New Revision: 1619726 URL: http://svn.apache.org/r1619726 Log: Remove some test specific apr_io wrappers that duplicate svn_io code. * subversion/tests/libsvn_subr/translate-test.c (create_file): Use standard error handling wrappers. (remove_file): Remove function. (substitute_and_verify): Use standard delete functions instead of local reimplementation. Modified: subversion/trunk/subversion/tests/libsvn_subr/translate-test.c Modified: subversion/trunk/subversion/tests/libsvn_subr/translate-test.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/translate-test.c?rev=1619726&r1=1619725&r2=1619726&view=diff ============================================================================== --- subversion/trunk/subversion/tests/libsvn_subr/translate-test.c (original) +++ subversion/trunk/subversion/tests/libsvn_subr/translate-test.c Fri Aug 22 10:00:03 2014 @@ -223,15 +223,12 @@ random_eol_marker(void) static svn_error_t * create_file(const char *fname, const char *eol_str, apr_pool_t *pool) { - apr_status_t apr_err; apr_file_t *f; apr_size_t i, j; - apr_err = apr_file_open(&f, fname, + SVN_ERR(svn_io_file_open(&f, fname, (APR_WRITE | APR_CREATE | APR_EXCL | APR_BINARY), - APR_OS_DEFAULT, pool); - if (apr_err) - return svn_error_create(apr_err, NULL, fname); + APR_OS_DEFAULT, pool)); for (i = 0; i < (sizeof(lines) / sizeof(*lines)); i++) { @@ -243,45 +240,13 @@ create_file(const char *fname, const cha fprintf() doing a newline conversion? */ for (j = 0; this_eol_str[j]; j++) { - apr_err = apr_file_putc(this_eol_str[j], f); - if (apr_err) - return svn_error_create(apr_err, NULL, fname); + SVN_ERR(svn_io_file_putc(this_eol_str[j], f, pool)); } } - apr_err = apr_file_close(f); - if (apr_err) - return svn_error_create(apr_err, NULL, fname); - - return SVN_NO_ERROR; -} - - -/* If FNAME is a regular file, remove it; if it doesn't exist at all, - return success. Otherwise, return error. */ -static svn_error_t * -remove_file(const char *fname, apr_pool_t *pool) -{ - apr_status_t apr_err; - apr_finfo_t finfo; - - if (apr_stat(&finfo, fname, APR_FINFO_TYPE, pool) == APR_SUCCESS) - { - if (finfo.filetype == APR_REG) - { - apr_err = apr_file_remove(fname, pool); - if (apr_err) - return svn_error_create(apr_err, NULL, fname); - } - else - return svn_error_createf(SVN_ERR_TEST_FAILED, NULL, - "non-file '%s' is in the way", fname); - } - - return SVN_NO_ERROR; + return svn_error_trace(svn_io_file_close(f, pool)); } - /* Set up, run, and verify the results of a substitution. * * Create a file TEST_NAME.src using global `lines' as the initial @@ -331,8 +296,8 @@ substitute_and_verify(const char *test_n apr_pool_t *subpool = svn_pool_create(pool); /** Clean up from previous tests, set up src data, and convert. **/ - SVN_ERR(remove_file(src_fname, pool)); - SVN_ERR(remove_file(dst_fname, pool)); + SVN_ERR(svn_io_remove_file2(src_fname, TRUE, pool)); + SVN_ERR(svn_io_remove_file2(dst_fname, TRUE, pool)); SVN_ERR(create_file(src_fname, src_eol, pool)); if (rev) @@ -395,7 +360,7 @@ substitute_and_verify(const char *test_n else { svn_error_clear(err); - SVN_ERR(remove_file(src_fname, pool)); + SVN_ERR(svn_io_remove_file2(src_fname, FALSE, pool)); return SVN_NO_ERROR; } @@ -769,8 +734,8 @@ substitute_and_verify(const char *test_n } /* Clean up this test, since successful. */ - SVN_ERR(remove_file(src_fname, pool)); - SVN_ERR(remove_file(dst_fname, pool)); + SVN_ERR(svn_io_remove_file2(src_fname, FALSE, pool)); + SVN_ERR(svn_io_remove_file2(dst_fname, FALSE, pool)); return SVN_NO_ERROR; }