Index: subversion/libsvn_subr/path.c
===================================================================
--- subversion/libsvn_subr/path.c	(revision 12598)
+++ subversion/libsvn_subr/path.c	(working copy)
@@ -711,40 +711,36 @@
 skip_uri_schema (const char *path)
 {
   apr_size_t j;
-  apr_size_t len = strlen (path);
 
-  /* ### Taking strlen() initially is inefficient.  It's a holdover
-     from svn_stringbuf_t days. */
+  assert (path);
 
-  /* Make sure we have enough characters to even compare. */
-  if (len < 4)
+  /* <scheme> has length > 0 and doesn't contain ':' or '/'.
+     (i.e. the first char is not ':' or '/')
+     path[1] and path[2] are tested to assert the precondition
+     of the following loop. */
+  if (path[0] == '\0' || path[0] == ':' || path[0] == '/'
+      || path[1] == '\0' || path[2] == '\0')
     return NULL;
 
-  /* Look for the sequence '://' */
-  for (j = 0; j < len - 3; j++)
+  for (j = 1; path[j + 2] != '\0'; ++j)
     {
-      /* We hit a '/' before finding the sequence. */
+      /* precondition: */
+      assert (path[j] != '\0');
+      assert (path[j + 1] != '\0');
+
+      /* scheme doesn't contain a '/' */
       if (path[j] == '/')
         return NULL;
 
-      /* Skip stuff up to the first ':'. */
-      if (path[j] != ':')
-        continue;
-
-      /* Current character is a ':' now.  It better not be the first
-         character. */
-      if (j == 0)
-        return NULL;
-
-      /* Expecting the next two chars to be '/' */
-
-      if ((path[j + 1] == '/')
-          && (path[j + 2] == '/'))
-        return path + j + 3;
-      
-      return NULL;
+      if (path[j] == ':')
+        {
+          if (path[j + 1] == '/' && path[j + 2] == '/')
+            return path + j + 3;
+          else
+            return NULL;
+        }
     }
-     
+
   return NULL;
 }
 
Index: subversion/tests/libsvn_subr/path-test.c
===================================================================
--- subversion/tests/libsvn_subr/path-test.c	(revision 12598)
+++ subversion/tests/libsvn_subr/path-test.c	(working copy)
@@ -154,6 +154,8 @@
     "http://svn.collab.net/repos/svn",
     "scheme/with://slash/",
     "file:///path/to/repository",
+    "file://",
+    "file:/",
   };
 
   /* Expected results of the tests. */
@@ -162,14 +164,17 @@
     FALSE,
     TRUE,
     FALSE,
-    TRUE };
+    TRUE,
+    TRUE,
+    FALSE,
+  };
 
   *msg = "test svn_path_is_url";
 
   if (msg_only)
     return SVN_NO_ERROR;
 
-  for (i = 0; i < 5; i++)
+  for (i = 0; i < sizeof (paths) / sizeof (paths[0]); i++)
     {
       svn_boolean_t retval;
 

