OSDN Git Service

l10n: Updated Bulgarian translation of git (1307t0f921u)
[git-core/git.git] / cache-tree.c
index 2130f32..7fa524a 100644 (file)
@@ -75,11 +75,7 @@ static struct cache_tree_sub *find_subtree(struct cache_tree *it,
                return NULL;
 
        pos = -pos-1;
-       if (it->subtree_alloc <= it->subtree_nr) {
-               it->subtree_alloc = alloc_nr(it->subtree_alloc);
-               it->down = xrealloc(it->down, it->subtree_alloc *
-                                   sizeof(*it->down));
-       }
+       ALLOC_GROW(it->down, it->subtree_nr + 1, it->subtree_alloc);
        it->subtree_nr++;
 
        down = xmalloc(sizeof(*down) + pathlen + 1);
@@ -554,19 +550,18 @@ static struct cache_tree *cache_tree_find(struct cache_tree *it, const char *pat
                struct cache_tree_sub *sub;
 
                slash = strchrnul(path, '/');
-               /* between path and slash is the name of the
-                * subtree to look for.
+               /*
+                * Between path and slash is the name of the subtree
+                * to look for.
                 */
                sub = find_subtree(it, path, slash - path, 0);
                if (!sub)
                        return NULL;
                it = sub->cache_tree;
-               if (*slash)
-                       while (*slash && *slash == '/')
-                               slash++;
-               if (!*slash)
-                       return it; /* prefix ended with slashes */
+
                path = slash;
+               while (*path == '/')
+                       path++;
        }
        return it;
 }