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

[PATCH] Reformat example code in hacking.html(no space before paren)

From: Ed Price <ed.price_at_gmail.com>
Date: 2006-02-26 15:49:04 CET

The code examples in hacking.html are still way too easy to read.
This patch makes them harder to read, by removing whitespace and
increasing "code crunch".

I'm not sure about the first diff chunk; it's not clear what kind of
"code" that is. Feel free to remove that part.

[[[

 * www/hacking.html: Reformat example code to conform to
   no-space-before-paren style (followup to r18471).

]]]

Index: www/hacking.html
===================================================================
--- www/hacking.html (revision 18619)
+++ www/hacking.html (working copy)
@@ -672,8 +672,8 @@
       then use two underscores following the module prefix. For
       example:</p>
       <pre>
- svn_fs_get_rev_prop () /* Part of published API. */
- svn_fs__parse_props () /* For internal use only. */
+ svn_fs_get_rev_prop() /* Part of published API. */
+ svn_fs__parse_props() /* For internal use only. */
       </pre>
 </li>

@@ -779,15 +779,15 @@
        it at the start of each iteration, then destroy it after the loop
        is done, like so:</p>
        <pre>
- apr_pool_t *subpool = svn_pool_create (pool);
+ apr_pool_t *subpool = svn_pool_create(pool);

          for (i = 0; i &lt; n; ++i)
          {
- svn_pool_clear (subpool);
- do_operation (..., subpool);
+ svn_pool_clear(subpool);
+ do_operation(..., subpool);
          }

- svn_pool_destroy (subpool);
+ svn_pool_destroy(subpool);
        </pre>
 </li>
 </ol>
@@ -809,20 +809,20 @@
 code:</p>

 <pre>
- apr_hash_t *persistent_objects = apr_hash_make (pool);
- apr_pool_t *subpool = svn_pool_create (pool);
+ apr_hash_t *persistent_objects = apr_hash_make(pool);
+ apr_pool_t *subpool = svn_pool_create(pool);

       for (i = 0; i &lt; n; ++i)
       {
         const char *intermediate_result;
         const char *key, *val;

- svn_pool_clear (subpool);
- SVN_ERR (do_something (&amp;intermediate_result, ..., subpool));
- SVN_ERR (get_result (intermediate_result, &amp;key, &amp;val,
..., pool));
- apr_hash_set (persistent_objects, key, APR_HASH_KEY_STRING, val);
+ svn_pool_clear(subpool);
+ SVN_ERR(do_something(&amp;intermediate_result, ..., subpool));
+ SVN_ERR(get_result(intermediate_result, &amp;key, &amp;val,
..., pool));
+ apr_hash_set(persistent_objects, key, APR_HASH_KEY_STRING, val);
       }
- svn_pool_destroy (subpool);
+ svn_pool_destroy(subpool);

       return persistent_objects;
 </pre>
@@ -843,8 +843,8 @@
    static foo_t *
    make_foo_object (arg1, arg2, apr_pool_t *pool)
    {
- apr_pool_t *subpool = svn_pool_create (pool);
- foo_t *foo = apr_palloc (subpool, sizeof (*foo));
+ apr_pool_t *subpool = svn_pool_create(pool);
+ foo_t *foo = apr_palloc(subpool, sizeof(*foo));

       foo-&gt;field1 = arg1;
       foo-&gt;field2 = arg2;
@@ -957,8 +957,8 @@
        something like this:</p>

     <pre>
-return svn_error_create (SVN_ERR_FOO, NULL,
- "User not permitted to write file");
+return svn_error_create(SVN_ERR_FOO, NULL,
+ "User not permitted to write file");
     </pre>

     <p>NOTICE the NULL field... indicating that this error has no
@@ -990,7 +990,7 @@
     <li><p>Throw the error upwards, unmodified:</p>

         <pre>
- error = some_routine (foo);
+ error = some_routine(foo);
         if (error)
           return (error);
         </pre>
@@ -998,7 +998,7 @@
         <p>Actually, a better way to do this would be with the
         SVN_ERR() macro, which does the same thing:</p>
         <pre>
- SVN_ERR (some_routine (foo));
+ SVN_ERR(some_routine(foo));
         </pre>
      </li>

@@ -1006,11 +1006,11 @@
            structure by including it as the "child" argument:</p>

         <pre>
- error = some_routine (foo);
+ error = some_routine(foo);
         if (error)
           {
- svn_error_t *wrapper = svn_error_create (SVN_ERR_FOO, error,
- "Authorization failed");
+ svn_error_t *wrapper = svn_error_create(SVN_ERR_FOO, error,
+ "Authorization failed");
            return wrapper;
           }
         </pre>
@@ -1020,11 +1020,11 @@
            your custom message:</p>

         <pre>
- error = some_routine (foo);
+ error = some_routine(foo);
         if (error)
           {
- return svn_error_quick_wrap (error,
- "Authorization failed");
+ return svn_error_quick_wrap(error,
+ "Authorization failed");
           }
         </pre>

@@ -1032,7 +1032,7 @@
            macro:</p>

         <pre>
- SVN_ERR_W (some_routine (foo), "Authorization failed");
+ SVN_ERR_W(some_routine(foo), "Authorization failed");
         </pre>
     </li>
     </ol>
@@ -1453,7 +1453,7 @@
 <p>And then, in `consume_count' in `cplus-dem.c':</p>

 <pre>
- while (isdigit ((unsigned char)**type))
+ while (isdigit((unsigned char)**type))
      {
        count *= 10;
        count += **type - '0';
@@ -1461,7 +1461,7 @@
          `_Utf390_1__1_9223372036854775807__9223372036854775'
          can cause this function to return a negative value.
          In this case we just consume until the end of the string. */
- if (count &gt; strlen (*type))
+ if (count &gt; strlen(*type))
         {
           *type = save;
           return 0;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Feb 26 18:52:10 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.