pack-objects: move 'layer' into 'struct packing_data'
[gitweb.git] / pack-objects.h
index 3cb5527eeb2b146719284928fd29ea8c9b60360b..ad3c2087641e8f017c5bfd202ac29cd7f1c57518 100644 (file)
@@ -101,8 +101,6 @@ struct object_entry {
        unsigned no_try_delta:1;
        unsigned in_pack_type:TYPE_BITS; /* could be delta */
 
-       unsigned char layer;
-
        unsigned preferred_base:1; /*
                                    * we do not pack this, but is available
                                    * to be used as the base object to delta
@@ -147,6 +145,7 @@ struct packing_data {
 
        /* delta islands */
        unsigned int *tree_depth;
+       unsigned char *layer;
 };
 
 void prepare_packing_data(struct packing_data *pdata);
@@ -369,4 +368,21 @@ static inline void oe_set_tree_depth(struct packing_data *pack,
        pack->tree_depth[e - pack->objects] = tree_depth;
 }
 
+static inline unsigned char oe_layer(struct packing_data *pack,
+                                    struct object_entry *e)
+{
+       if (!pack->layer)
+               return 0;
+       return pack->layer[e - pack->objects];
+}
+
+static inline void oe_set_layer(struct packing_data *pack,
+                               struct object_entry *e,
+                               unsigned char layer)
+{
+       if (!pack->layer)
+               ALLOC_ARRAY(pack->layer, pack->nr_objects);
+       pack->layer[e - pack->objects] = layer;
+}
+
 #endif