pack: move unuse_pack()

Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathan Tan committed Aug 18, 2017 at 15:20 UTC 97de1803f8972c41703424bb1697c224deb2b558
4 files changed +10 -10
cache.h
-1
@@ -1639,7 +1639,6 @@ extern int odb_mkstemp(struct strbuf *template, const char *pattern);
1639 */
1640 extern int odb_pack_keep(const char *name);
1641
1642 -extern void unuse_pack(struct pack_window **);
1642 extern void clear_delta_base_cache(void);
1643 extern struct packed_git *add_packed_git(const char *path, size_t path_len, int local);
1644
packfile.c
+9
@@ -596,3 +596,12 @@ unsigned char *use_pack(struct packed_git *p,
596 *left = win->len - xsize_t(offset);
597 return win->base + offset;
598 }
599 +
600 +void unuse_pack(struct pack_window **w_cursor)
601 +{
602 + struct pack_window *w = *w_cursor;
603 + if (w) {
604 + w->inuse_cnt--;
605 + *w_cursor = NULL;
606 + }
607 +}
packfile.h
+1
@@ -45,6 +45,7 @@ extern void close_pack_index(struct packed_git *);
45 extern unsigned char *use_pack(struct packed_git *, struct pack_window **, off_t, unsigned long *);
46 extern void close_pack_windows(struct packed_git *);
47 extern void close_all_packs(void);
48 +extern void unuse_pack(struct pack_window **);
49
50 extern void release_pack_memory(size_t);
51
sha1_file.c
-9
@@ -719,15 +719,6 @@ void *xmmap(void *start, size_t length,
719 return ret;
720 }
721
722 -void unuse_pack(struct pack_window **w_cursor)
723 -{
724 - struct pack_window *w = *w_cursor;
725 - if (w) {
726 - w->inuse_cnt--;
727 - *w_cursor = NULL;
728 - }
729 -}
730 -
722 static struct packed_git *alloc_packed_git(int extra)
723 {
724 struct packed_git *p = xmalloc(st_add(sizeof(*p), extra));