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

[PATCH]simple(for me only? not sure) typecasting

From: Kamesh Jayachandran <kamesh_at_collab.net>
Date: 2006-10-12 13:08:02 CEST

Hi All,
I found the following snippet in subversion/libsvn_subr/sorts.c.

<snip>
 svn_sort_compare_paths(const void *a, const void *b)
 {
  const char *item1 = *((const char * const *) a);
  const char *item2 = *((const char * const *) b);
  return svn_path_compare_paths(item1, item2);
 }
</snip>
I feel it is easier to understand 'const char *item1 = *((const char **)
a);' than 'const char *item1 = *((const char * const *) a);'.

Attaching the patch/log for the same.

With regards
Kamesh Jayachandran

[[[

Type casting can be simpler to understand if (const char **) than
(const char * const *).

* subversion/libsvn_subr/sorts.c
  (svn_sort_compare_paths):
   Changing the typecast as mentioned in the above summary.

Patch by: Kamesh Jayachandran <kamesh@collab.net>
]]]

Index: subversion/libsvn_subr/sorts.c
===================================================================
--- subversion/libsvn_subr/sorts.c (revision 21898)
+++ subversion/libsvn_subr/sorts.c (working copy)
@@ -104,8 +104,8 @@
 int
 svn_sort_compare_paths(const void *a, const void *b)
 {
- const char *item1 = *((const char * const *) a);
- const char *item2 = *((const char * const *) b);
+ const char *item1 = *((const char **) a);
+ const char *item2 = *((const char **) b);
 
   return svn_path_compare_paths(item1, item2);
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Oct 12 13:07:30 2006

This is an archived mail posted to the Subversion Dev mailing list.