Re: [RFC PATCH 1/5] packfile: make get_delta_base() non static

2018-07-27 Thread Jeff King
On Tue, Jul 24, 2018 at 09:19:27AM -0700, Junio C Hamano wrote:

> Christian Couder  writes:
> 
> > From: Jeff King 
> >
> > As get_delta_base() will be used outside 'packfile.c' in
> > a following commit, let's make it non static and let's
> > declare it in 'packfile.h'.
> 
> As a public function in *.h, don't we want a bit of comment there to
> help those who want to use it from outside packfile.c?

Arguably it may want a better name, too.

-Peff


Re: [RFC PATCH 1/5] packfile: make get_delta_base() non static

2018-07-24 Thread Junio C Hamano
Christian Couder  writes:

> From: Jeff King 
>
> As get_delta_base() will be used outside 'packfile.c' in
> a following commit, let's make it non static and let's
> declare it in 'packfile.h'.

As a public function in *.h, don't we want a bit of comment there to
help those who want to use it from outside packfile.c?


> Signed-off-by: Jeff King 
> Signed-off-by: Christian Couder 
> ---
>  packfile.c | 10 +-
>  packfile.h |  3 +++
>  2 files changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/packfile.c b/packfile.c
> index 7cd45aa4b2..4646bff5ff 100644
> --- a/packfile.c
> +++ b/packfile.c
> @@ -1037,11 +1037,11 @@ const struct packed_git *has_packed_and_bad(const 
> unsigned char *sha1)
>   return NULL;
>  }
>  
> -static off_t get_delta_base(struct packed_git *p,
> - struct pack_window **w_curs,
> - off_t *curpos,
> - enum object_type type,
> - off_t delta_obj_offset)
> +off_t get_delta_base(struct packed_git *p,
> +  struct pack_window **w_curs,
> +  off_t *curpos,
> +  enum object_type type,
> +  off_t delta_obj_offset)
>  {
>   unsigned char *base_info = use_pack(p, w_curs, *curpos, NULL);
>   off_t base_offset;
> diff --git a/packfile.h b/packfile.h
> index cc7eaffe1b..30f0811382 100644
> --- a/packfile.h
> +++ b/packfile.h
> @@ -125,6 +125,9 @@ extern void *unpack_entry(struct repository *r, struct 
> packed_git *, off_t, enum
>  extern unsigned long unpack_object_header_buffer(const unsigned char *buf, 
> unsigned long len, enum object_type *type, unsigned long *sizep);
>  extern unsigned long get_size_from_delta(struct packed_git *, struct 
> pack_window **, off_t);
>  extern int unpack_object_header(struct packed_git *, struct pack_window **, 
> off_t *, unsigned long *);
> +extern off_t get_delta_base(struct packed_git *p, struct pack_window 
> **w_curs,
> + off_t *curpos, enum object_type type,
> + off_t delta_obj_offset);
>  
>  extern void release_pack_memory(size_t);


[RFC PATCH 1/5] packfile: make get_delta_base() non static

2018-07-21 Thread Christian Couder
From: Jeff King 

As get_delta_base() will be used outside 'packfile.c' in
a following commit, let's make it non static and let's
declare it in 'packfile.h'.

Signed-off-by: Jeff King 
Signed-off-by: Christian Couder 
---
 packfile.c | 10 +-
 packfile.h |  3 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/packfile.c b/packfile.c
index 7cd45aa4b2..4646bff5ff 100644
--- a/packfile.c
+++ b/packfile.c
@@ -1037,11 +1037,11 @@ const struct packed_git *has_packed_and_bad(const 
unsigned char *sha1)
return NULL;
 }
 
-static off_t get_delta_base(struct packed_git *p,
-   struct pack_window **w_curs,
-   off_t *curpos,
-   enum object_type type,
-   off_t delta_obj_offset)
+off_t get_delta_base(struct packed_git *p,
+struct pack_window **w_curs,
+off_t *curpos,
+enum object_type type,
+off_t delta_obj_offset)
 {
unsigned char *base_info = use_pack(p, w_curs, *curpos, NULL);
off_t base_offset;
diff --git a/packfile.h b/packfile.h
index cc7eaffe1b..30f0811382 100644
--- a/packfile.h
+++ b/packfile.h
@@ -125,6 +125,9 @@ extern void *unpack_entry(struct repository *r, struct 
packed_git *, off_t, enum
 extern unsigned long unpack_object_header_buffer(const unsigned char *buf, 
unsigned long len, enum object_type *type, unsigned long *sizep);
 extern unsigned long get_size_from_delta(struct packed_git *, struct 
pack_window **, off_t);
 extern int unpack_object_header(struct packed_git *, struct pack_window **, 
off_t *, unsigned long *);
+extern off_t get_delta_base(struct packed_git *p, struct pack_window **w_curs,
+   off_t *curpos, enum object_type type,
+   off_t delta_obj_offset);
 
 extern void release_pack_memory(size_t);
 
-- 
2.18.0.237.gffdb1dbdaa