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

Re: boolean issue with serf

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Sat, 18 Apr 2009 14:07:50 +0200

C. Michael Pilato wrote:
> Lieven Govaerts wrote:
>> On 04/16/2009 09:48 PM, Lieven Govaerts wrote:
>>> On 04/16/2009 09:39 PM, Stefan Küng wrote:
>>>> On Thu, Apr 16, 2009 at 21:30, Stefan Küng<tortoisesvn_at_gmail.com>
>>>> wrote:
>>> ..
>>>> A quick search through the files revealed:
>>>>
>>>> libsvn_ra_serf\locks.c, line 720 (1.6.x branch), function
>>>> svn_ra_serf__unlock():
>>>> if (force == TRUE&& (!token || token[0] == '\0'))
>>>>
>>>> libsvn_ra_serf\locks.c, line 329(1.6.x branch), function
>>>> set_lock_headers():
>>>> if (lock_ctx->force == TRUE)
>>>>
>>> I would find it very counter-intuitive to change these to:
>>> if (lock_ctx->force != FALSE) ...
>>> ... and to ensure that people are going to remember a rule like this in
>>> the future.
>>>
>> ... most of our TRUE checks are done as "if (lock_ctx->force)" though,
>> wouldn't have a problem with that.
>
> Nor would I.
>

I've attached a patch which replaces all if(xxx == TRUE) statements with
if(xxx) (well, all that I found in trunk with a simple grep search).

Not sure about the commit message though: is it really necessary to list
all functions that are affected for such a change?

Stefan

-- 
       ___
  oo  // \\      "De Chelonian Mobile"
 (_,\/ \_/ \     TortoiseSVN
   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
   /_/   \_\     http://tortoisesvn.net
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1788451

[[[
Compare against non-zero instead of equal to TRUE.

* subversion/libsvn_client/patch.c,
  subversion/libsvn_fs_base/fs.c,
  subversion/libsvn_ra_serf/blame.c
  subversion/libsvn_ra_serf/commit.c
  subversion/libsvn_ra_serf/locks.c
  subversion/libsvn_ra_serf/options.c
  subversion/libsvn_ra_serf/property.c
  subversion/libsvn_ra_serf/replay.c
  subversion/libsvn_ra_serf/update.c
  subversion/libsvn_ra_svn/client.c
  subversion/libsvn_repos/hooks.c
  subversion/libsvn_subr/io.c
  subversion/libsvn_subr/win32_crashrpt.c
  subversion/mod_dav_svn/version.c:
  replace if( xxx == TRUE) with if( xxx ).
]]]
Index: subversion/libsvn_client/patch.c
===================================================================
--- subversion/libsvn_client/patch.c (Revision 37352)
+++ subversion/libsvn_client/patch.c (Arbeitskopie)
@@ -1675,7 +1675,7 @@
             }
         }
 
- if (svnpatch_header_found == TRUE)
+ if (svnpatch_header_found)
         {
           break;
         }
Index: subversion/libsvn_fs_base/fs.c
===================================================================
--- subversion/libsvn_fs_base/fs.c (Revision 37352)
+++ subversion/libsvn_fs_base/fs.c (Arbeitskopie)
@@ -1292,7 +1292,7 @@
   SVN_ERR(svn_io_write_version_file
           (svn_path_join(dest_path, FORMAT_FILE, pool), format, pool));
 
- if (clean_logs == TRUE)
+ if (clean_logs)
     SVN_ERR(svn_fs_base__clean_logs(src_path, dest_path, pool));
 
   return SVN_NO_ERROR;
Index: subversion/libsvn_ra_serf/blame.c
===================================================================
--- subversion/libsvn_ra_serf/blame.c (Revision 37352)
+++ subversion/libsvn_ra_serf/blame.c (Arbeitskopie)
@@ -156,7 +156,7 @@
 
   /* Include the null term. */
   s = svn_string_ncreate(info->prop_attr, info->prop_attr_len + 1, info->pool);
- if (info->prop_base64 == TRUE)
+ if (info->prop_base64)
     {
       s = svn_base64_decode_string(s, info->pool);
     }
Index: subversion/libsvn_ra_serf/commit.c
===================================================================
--- subversion/libsvn_ra_serf/commit.c (Revision 37352)
+++ subversion/libsvn_ra_serf/commit.c (Arbeitskopie)
@@ -621,7 +621,7 @@
                                     "V:encoding", binary_prop ? "base64" : NULL,
                                     NULL);
 
- if (binary_prop == TRUE)
+ if (binary_prop)
     {
       serf_bucket_t *tmp_bkt;
       val = svn_base64_encode_string2(val, TRUE, pool);
Index: subversion/libsvn_ra_serf/locks.c
===================================================================
--- subversion/libsvn_ra_serf/locks.c (Revision 37352)
+++ subversion/libsvn_ra_serf/locks.c (Arbeitskopie)
@@ -326,7 +326,7 @@
 {
   lock_info_t *lock_ctx = baton;
 
- if (lock_ctx->force == TRUE)
+ if (lock_ctx->force)
     {
       serf_bucket_headers_set(headers, SVN_DAV_OPTIONS_HEADER,
                               SVN_DAV_OPTION_LOCK_STEAL);
@@ -717,7 +717,7 @@
       path = key;
       token = val;
 
- if (force == TRUE && (!token || token[0] == '\0'))
+ if (force && (!token || token[0] == '\0'))
         {
           svn_lock_t *lock;
 
Index: subversion/libsvn_ra_serf/options.c
===================================================================
--- subversion/libsvn_ra_serf/options.c (Revision 37352)
+++ subversion/libsvn_ra_serf/options.c (Arbeitskopie)
@@ -198,7 +198,7 @@
               apr_size_t len)
 {
   svn_ra_serf__options_context_t *ctx = userData;
- if (ctx->collect_cdata == TRUE)
+ if (ctx->collect_cdata)
     {
       svn_ra_serf__expand_string(&ctx->attr_val, &ctx->attr_val_len,
                                  data, len, ctx->pool);
Index: subversion/libsvn_ra_serf/property.c
===================================================================
--- subversion/libsvn_ra_serf/property.c (Revision 37352)
+++ subversion/libsvn_ra_serf/property.c (Arbeitskopie)
@@ -423,7 +423,7 @@
 {
   svn_ra_serf__propfind_context_t *ctx = setup_baton;
 
- if (ctx->conn->using_compression == TRUE)
+ if (ctx->conn->using_compression)
     {
       serf_bucket_headers_setn(headers, "Accept-Encoding", "gzip");
     }
@@ -578,7 +578,7 @@
       svn_ra_serf__handler_t *handler;
       svn_ra_serf__xml_parser_t *parser_ctx;
 
- if (cache_props == TRUE)
+ if (cache_props)
         {
           svn_boolean_t cache_satisfy;
 
Index: subversion/libsvn_ra_serf/replay.c
===================================================================
--- subversion/libsvn_ra_serf/replay.c (Revision 37352)
+++ subversion/libsvn_ra_serf/replay.c (Arbeitskopie)
@@ -499,7 +499,7 @@
       prop_info_t *info = parser->state->private;
       const svn_string_t *prop_val;
 
- if (info->del_prop == TRUE)
+ if (info->del_prop)
         {
           prop_val = NULL;
         }
Index: subversion/libsvn_ra_serf/update.c
===================================================================
--- subversion/libsvn_ra_serf/update.c (Revision 37352)
+++ subversion/libsvn_ra_serf/update.c (Arbeitskopie)
@@ -656,7 +656,7 @@
       serf_bucket_headers_setn(headers, "Accept-Encoding",
                                "svndiff1;q=0.9,svndiff;q=0.8");
     }
- else if (fetch_ctx->conn->using_compression == TRUE)
+ else if (fetch_ctx->conn->using_compression)
     {
       serf_bucket_headers_setn(headers, "Accept-Encoding", "gzip");
     }
@@ -683,7 +683,7 @@
        * to hold subsequent read() ops until we get back to where we were
        * before the close and we can then resume the textdelta() calls.
        */
- if (fetch_ctx->read_headers == TRUE)
+ if (fetch_ctx->read_headers)
         {
           if (fetch_ctx->aborted_read == FALSE && fetch_ctx->read_size)
             {
@@ -836,7 +836,7 @@
 
       fetch_ctx->read_size += len;
 
- if (fetch_ctx->aborted_read == TRUE)
+ if (fetch_ctx->aborted_read)
         {
           /* We haven't caught up to where we were before. */
           if (fetch_ctx->read_size < fetch_ctx->aborted_read_size)
@@ -990,7 +990,7 @@
 
       fetch_ctx->read_size += len;
 
- if (fetch_ctx->aborted_read == TRUE)
+ if (fetch_ctx->aborted_read)
         {
           /* We haven't caught up to where we were before. */
           if (fetch_ctx->read_size < fetch_ctx->aborted_read_size)
@@ -1149,7 +1149,7 @@
   /* If we've been asked to fetch the file or its an add, do so.
    * Otherwise, handle the case where only the properties changed.
    */
- if (info->fetch_file && ctx->text_deltas == TRUE)
+ if (info->fetch_file && ctx->text_deltas)
     {
       report_fetch_t *fetch_ctx;
 
Index: subversion/libsvn_ra_svn/client.c
===================================================================
--- subversion/libsvn_ra_svn/client.c (Revision 37352)
+++ subversion/libsvn_ra_svn/client.c (Arbeitskopie)
@@ -1298,7 +1298,7 @@
       /* Because the svn protocol won't let us send an invalid revnum, we have
          to recover that fact using the extra parameter. */
       if (invalid_revnum_param != SVN_RA_SVN_UNSPECIFIED_NUMBER
- && invalid_revnum_param == TRUE)
+ && invalid_revnum_param)
         rev = SVN_INVALID_REVNUM;
 
       if (cplist->nelts > 0)
Index: subversion/libsvn_repos/hooks.c
===================================================================
--- subversion/libsvn_repos/hooks.c (Revision 37352)
+++ subversion/libsvn_repos/hooks.c (Arbeitskopie)
@@ -351,7 +351,7 @@
       svn_error_clear(err);
       if (!(err = svn_io_check_special_path(hook_path, &kind, &is_special,
                                             pool))
- && is_special == TRUE)
+ && is_special)
         {
           *broken_link = TRUE;
           return hook_path;
Index: subversion/libsvn_subr/io.c
===================================================================
--- subversion/libsvn_subr/io.c (Revision 37352)
+++ subversion/libsvn_subr/io.c (Arbeitskopie)
@@ -1576,14 +1576,14 @@
   apr_int32_t flags;
   apr_status_t apr_err;
 
- if (exclusive == TRUE)
+ if (exclusive)
     locktype = APR_FLOCK_EXCLUSIVE;
 
   flags = APR_READ;
   if (locktype == APR_FLOCK_EXCLUSIVE)
     flags |= APR_WRITE;
 
- if (nonblocking == TRUE)
+ if (nonblocking)
     locktype |= APR_FLOCK_NONBLOCK;
 
   SVN_ERR(svn_io_file_open(&lockfile_handle, lock_file, flags,
Index: subversion/libsvn_subr/win32_crashrpt.c
===================================================================
--- subversion/libsvn_subr/win32_crashrpt.c (Revision 37352)
+++ subversion/libsvn_subr/win32_crashrpt.c (Arbeitskopie)
@@ -393,7 +393,7 @@
   else
     return FALSE;
 
- if (log_params == TRUE && sym_info->Flags & SYMFLAG_PARAMETER)
+ if (log_params && sym_info->Flags & SYMFLAG_PARAMETER)
     {
       if (last_nr_of_frame == nr_of_frame)
         fprintf(log_file, ", ", 2);
@@ -441,7 +441,7 @@
   /* log the function name */
   pIHS->SizeOfStruct = sizeof(SYMBOL_INFO);
   pIHS->MaxNameLen = MAX_PATH;
- if (SymFromAddr_(proc, stack_frame.AddrPC.Offset, &func_disp, pIHS) == TRUE)
+ if (SymFromAddr_(proc, stack_frame.AddrPC.Offset, &func_disp, pIHS))
     {
       fprintf(log_file,
                     "#%d 0x%08x in %.200s (",
@@ -750,7 +750,7 @@
     return EXCEPTION_CONTINUE_SEARCH;
 
   /* don't log anything if we're running inside a debugger ... */
- if (is_debugger_present() == TRUE)
+ if (is_debugger_present())
     return EXCEPTION_CONTINUE_SEARCH;
 
   /* ... or if we can't create the log files ... */
Index: subversion/mod_dav_svn/version.c
===================================================================
--- subversion/mod_dav_svn/version.c (Revision 37352)
+++ subversion/mod_dav_svn/version.c (Arbeitskopie)
@@ -1069,7 +1069,7 @@
    * be an activity URL. Otherwise, it must be a real activity URL that
    * doesn't already exist.
    */
- return (resource->info->auto_checked_out == TRUE ||
+ return (resource->info->auto_checked_out ||
           (resource->type == DAV_RESOURCE_TYPE_ACTIVITY &&
            !resource->exists));
 }

Received on 2009-04-18 14:08:12 CEST

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.