Remove unused object-ref code
[gitweb.git] / cache-tree.c
index 76af6f5d992d54f4abaafd0a7ea32c82f2d4ab89..50b35264fd0405a299700ef8bf4a61f416f30e46 100644 (file)
@@ -1,5 +1,4 @@
 #include "cache.h"
-#include "strbuf.h"
 #include "tree.h"
 #include "cache-tree.h"
 
@@ -293,8 +292,7 @@ static int update_one(struct cache_tree *it,
        /*
         * Then write out the tree object for this level.
         */
-       strbuf_init(&buffer);
-       strbuf_grow(&buffer, 8192);
+       strbuf_init(&buffer, 8192);
 
        for (i = 0; i < entries; i++) {
                struct cache_entry *ce = cache[i];
@@ -371,10 +369,8 @@ int cache_tree_update(struct cache_tree *it,
        return 0;
 }
 
-static void write_one(struct cache_tree *it,
-                      char *path,
-                      int pathlen,
-                          struct strbuf *buffer)
+static void write_one(struct strbuf *buffer, struct cache_tree *it,
+                      const char *path, int pathlen)
 {
        int i;
 
@@ -409,20 +405,13 @@ static void write_one(struct cache_tree *it,
                                             prev->name, prev->namelen) <= 0)
                                die("fatal - unsorted cache subtree");
                }
-               write_one(down->cache_tree, down->name, down->namelen, buffer);
+               write_one(buffer, down->cache_tree, down->name, down->namelen);
        }
 }
 
-void *cache_tree_write(struct cache_tree *root, unsigned long *size_p)
+void cache_tree_write(struct strbuf *sb, struct cache_tree *root)
 {
-       char path[PATH_MAX];
-       struct strbuf buffer;
-
-       path[0] = 0;
-       strbuf_init(&buffer);
-       write_one(root, path, 0, &buffer);
-       *size_p = buffer.len;
-       return strbuf_detach(&buffer);
+       write_one(sb, root, "", 0);
 }
 
 static struct cache_tree *read_one(const char **buffer, unsigned long *size_p)