You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2010/10/27 12:30:38 UTC

svn commit: r1027896 - /subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c

Author: philip
Date: Wed Oct 27 10:30:38 2010
New Revision: 1027896

URL: http://svn.apache.org/viewvc?rev=1027896&view=rev
Log:
* subversion/tests/libsvn_wc/op-depth-test.c
  (wc_wc_copies): Use "const char []" for constants rather than #define.

Modified:
    subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c

Modified: subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c?rev=1027896&r1=1027895&r2=1027896&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Wed Oct 27 10:30:38 2010
@@ -411,19 +411,19 @@ check_db_rows(wc_baton_t *b,
 static svn_error_t *
 wc_wc_copies(wc_baton_t *b)
 {
-  SVN_ERR(add_and_commit_greek_tree(b));
+  const char source_everything[]  = "A/B";
 
-#define source_everything  "A/B"
+  const char source_base_file[]   = "A/B/lambda";
+  const char source_base_dir[]    = "A/B/E";
 
-#define source_base_file   "A/B/lambda"
-#define source_base_dir    "A/B/E"
+  const char source_added_file[]  = "A/B/file-added";
+  const char source_added_dir[]   = "A/B/D-added";
+  const char source_added_dir2[]  = "A/B/D-added/D2";
 
-#define source_added_file  "A/B/file-added"
-#define source_added_dir   "A/B/D-added"
-#define source_added_dir2  "A/B/D-added/D2"
+  const char source_copied_file[] = "A/B/lambda-copied";
+  const char source_copied_dir[]  = "A/B/E-copied";
 
-#define source_copied_file "A/B/lambda-copied"
-#define source_copied_dir  "A/B/E-copied"
+  SVN_ERR(add_and_commit_greek_tree(b));
 
   /* Create the various kinds of source node which will be copied */
 



Re: svn commit: r1027896 - /subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c

Posted by Philip Martin <ph...@wandisco.com>.
Blair Zajac <bl...@orcaware.com> writes:

> On 10/27/2010 09:52 AM, Philip Martin wrote:
>> "Hyrum K. Wright"<hy...@mail.utexas.edu>  writes:
>>
>>>> +  const char source_copied_file[] = "A/B/lambda-copied";
>>>> +  const char source_copied_dir[]  = "A/B/E-copied";
>>>>
>>>> -#define source_copied_file "A/B/lambda-copied"
>>>> -#define source_copied_dir  "A/B/E-copied"
>>>> +  SVN_ERR(add_and_commit_greek_tree(b));
>>>>
>>>>    /* Create the various kinds of source node which will be copied */
>>>
>>> Nice change, but minor style nit: I think we use 'const char *' for
>>> these types of expressions, instead of the array syntax.  (Or at
>>> least, I prefer the former :)
>>
>> The reason Julian used #define is that a 'const char *' cannot later be
>> used as an initializer; 'const char []' can.
>
> While we're talking style nits, making these static would be nice also :)

Ah, yes.  Making them static would allow them to be 'const char *' as
well.

-- 
Philip

Re: svn commit: r1027896 - /subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c

Posted by Blair Zajac <bl...@orcaware.com>.
On 10/27/2010 09:52 AM, Philip Martin wrote:
> "Hyrum K. Wright"<hy...@mail.utexas.edu>  writes:
>
>>> +  const char source_copied_file[] = "A/B/lambda-copied";
>>> +  const char source_copied_dir[]  = "A/B/E-copied";
>>>
>>> -#define source_copied_file "A/B/lambda-copied"
>>> -#define source_copied_dir  "A/B/E-copied"
>>> +  SVN_ERR(add_and_commit_greek_tree(b));
>>>
>>>    /* Create the various kinds of source node which will be copied */
>>
>> Nice change, but minor style nit: I think we use 'const char *' for
>> these types of expressions, instead of the array syntax.  (Or at
>> least, I prefer the former :)
>
> The reason Julian used #define is that a 'const char *' cannot later be
> used as an initializer; 'const char []' can.

While we're talking style nits, making these static would be nice also :)

Blair

Re: svn commit: r1027896 - /subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c

Posted by Philip Martin <ph...@wandisco.com>.
"Hyrum K. Wright" <hy...@mail.utexas.edu> writes:

>> +  const char source_copied_file[] = "A/B/lambda-copied";
>> +  const char source_copied_dir[]  = "A/B/E-copied";
>>
>> -#define source_copied_file "A/B/lambda-copied"
>> -#define source_copied_dir  "A/B/E-copied"
>> +  SVN_ERR(add_and_commit_greek_tree(b));
>>
>>   /* Create the various kinds of source node which will be copied */
>
> Nice change, but minor style nit: I think we use 'const char *' for
> these types of expressions, instead of the array syntax.  (Or at
> least, I prefer the former :)

The reason Julian used #define is that a 'const char *' cannot later be
used as an initializer; 'const char []' can.

-- 
Philip

Re: svn commit: r1027896 - /subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c

Posted by "Hyrum K. Wright" <hy...@mail.utexas.edu>.
On Wed, Oct 27, 2010 at 5:30 AM,  <ph...@apache.org> wrote:
> Author: philip
> Date: Wed Oct 27 10:30:38 2010
> New Revision: 1027896
>
> URL: http://svn.apache.org/viewvc?rev=1027896&view=rev
> Log:
> * subversion/tests/libsvn_wc/op-depth-test.c
>  (wc_wc_copies): Use "const char []" for constants rather than #define.
>
> Modified:
>    subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
>
> Modified: subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c?rev=1027896&r1=1027895&r2=1027896&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
> +++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Wed Oct 27 10:30:38 2010
> @@ -411,19 +411,19 @@ check_db_rows(wc_baton_t *b,
>  static svn_error_t *
>  wc_wc_copies(wc_baton_t *b)
>  {
> -  SVN_ERR(add_and_commit_greek_tree(b));
> +  const char source_everything[]  = "A/B";
>
> -#define source_everything  "A/B"
> +  const char source_base_file[]   = "A/B/lambda";
> +  const char source_base_dir[]    = "A/B/E";
>
> -#define source_base_file   "A/B/lambda"
> -#define source_base_dir    "A/B/E"
> +  const char source_added_file[]  = "A/B/file-added";
> +  const char source_added_dir[]   = "A/B/D-added";
> +  const char source_added_dir2[]  = "A/B/D-added/D2";
>
> -#define source_added_file  "A/B/file-added"
> -#define source_added_dir   "A/B/D-added"
> -#define source_added_dir2  "A/B/D-added/D2"
> +  const char source_copied_file[] = "A/B/lambda-copied";
> +  const char source_copied_dir[]  = "A/B/E-copied";
>
> -#define source_copied_file "A/B/lambda-copied"
> -#define source_copied_dir  "A/B/E-copied"
> +  SVN_ERR(add_and_commit_greek_tree(b));
>
>   /* Create the various kinds of source node which will be copied */

Nice change, but minor style nit: I think we use 'const char *' for
these types of expressions, instead of the array syntax.  (Or at
least, I prefer the former :)

-Hyrum

Re: svn commit: r1027896 - /subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c

Posted by "Hyrum K. Wright" <hy...@mail.utexas.edu>.
On Wed, Oct 27, 2010 at 5:30 AM,  <ph...@apache.org> wrote:
> Author: philip
> Date: Wed Oct 27 10:30:38 2010
> New Revision: 1027896
>
> URL: http://svn.apache.org/viewvc?rev=1027896&view=rev
> Log:
> * subversion/tests/libsvn_wc/op-depth-test.c
>  (wc_wc_copies): Use "const char []" for constants rather than #define.
>
> Modified:
>    subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
>
> Modified: subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c?rev=1027896&r1=1027895&r2=1027896&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c (original)
> +++ subversion/trunk/subversion/tests/libsvn_wc/op-depth-test.c Wed Oct 27 10:30:38 2010
> @@ -411,19 +411,19 @@ check_db_rows(wc_baton_t *b,
>  static svn_error_t *
>  wc_wc_copies(wc_baton_t *b)
>  {
> -  SVN_ERR(add_and_commit_greek_tree(b));
> +  const char source_everything[]  = "A/B";
>
> -#define source_everything  "A/B"
> +  const char source_base_file[]   = "A/B/lambda";
> +  const char source_base_dir[]    = "A/B/E";
>
> -#define source_base_file   "A/B/lambda"
> -#define source_base_dir    "A/B/E"
> +  const char source_added_file[]  = "A/B/file-added";
> +  const char source_added_dir[]   = "A/B/D-added";
> +  const char source_added_dir2[]  = "A/B/D-added/D2";
>
> -#define source_added_file  "A/B/file-added"
> -#define source_added_dir   "A/B/D-added"
> -#define source_added_dir2  "A/B/D-added/D2"
> +  const char source_copied_file[] = "A/B/lambda-copied";
> +  const char source_copied_dir[]  = "A/B/E-copied";
>
> -#define source_copied_file "A/B/lambda-copied"
> -#define source_copied_dir  "A/B/E-copied"
> +  SVN_ERR(add_and_commit_greek_tree(b));
>
>   /* Create the various kinds of source node which will be copied */

Nice change, but minor style nit: I think we use 'const char *' for
these types of expressions, instead of the array syntax.  (Or at
least, I prefer the former :)

-Hyrum