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

Repost: [PATCH] Optimization svn_path_compare_paths

From: Sander Striker <striker_at_apache.org>
Date: 2001-09-13 16:49:38 CEST

Hi,

Probably went by unseen.
If not, let me know the patch was rejected.

Sander

-----Original Message-----
From: Sander Striker [mailto:striker@apache.org]
Sent: 06 September 2001 02:15

Hi all,

The log says it all.

Sander

---
Log:
* path.c (svn_path_compare_paths): - Eliminate a call to strncmp
                                   - Remove unneeded else statements
Index: trunk/subversion/libsvn_subr/path.c
===================================================================
--- trunk/subversion/libsvn_subr/SVN/text-base/path.c   Thu Sep  6 01:14:16
2001
+++ trunk/subversion/libsvn_subr/path.c Thu Sep  6 02:00:37 2001
@@ -223,12 +223,17 @@
   if ((path1->len == path2->len) && (i >= min_len))
     return 0;     /* the paths are the same */
-  else if (path1->data[i] == dirsep)
+
+  if (path1->data[i] == dirsep)
     return 1;     /* path1 child of path2, parent always comes before child
*/
-  else if (path2->data[i] == dirsep)
+
+  if (path2->data[i] == dirsep)
     return -1;    /* path2 child of path1, parent always comes before child
*/
-  else
-    return strncmp (path1->data + i, path2->data + i, (min_len - i));
+
+  /* Common prefix was skipped above, next character is
+   * compared to determine order
+   */
+  return path1->data[i] < path2->data[i] ? -1 : 1;
 }
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:41 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.