Re: [RFC PATCH] lmdb: restrict the visibility of some symbols

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of directly applying this patch, I rearranged the code a bit,
but hopefully now have reduced the non-static surface area.  Thanks for
the suggestions.

On Mon, 2016-02-22 at 16:41 +0000, Ramsay Jones wrote:
> Signed-off-by: Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxxx>
> ---
> 
> Hi David,
> 
> If you need to re-roll your 'dt/refs-backend-lmdb' branch, please
> consider squashing something like this into the relevant patches.
> Note that I marked this as RFC, because I haven't got lmdb
> installed, so I can't actually test it! ;-)
> 
> So, I've just eyeballed it and, hopefully, it will actually work.
> 
> Let me know.
> 
> Thanks!
> 
> ATB,
> Ramsay Jones
> 
>  refs.c                   | 2 +-
>  refs.h                   | 5 ----- 
>  refs/refs-internal.h     | 3 +++
>  test-refs-lmdb-backend.c | 5 +++--
>  4 files changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/refs.c b/refs.c
> index 56960b5..337f110 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -22,7 +22,7 @@ static struct ref_storage_be *refs_backends = NULL;
>  
>  const char *ref_storage_backend = "files";
>  
> -void register_ref_storage_backend(struct ref_storage_be *be)
> +static void register_ref_storage_backend(struct ref_storage_be *be)
>  {
>  	be->next = refs_backends;
>  	refs_backends = be;
> diff --git a/refs.h b/refs.h
> index ad6d097..9cc3a37 100644
> --- a/refs.h
> +++ b/refs.h
> @@ -515,9 +515,6 @@ extern int reflog_expire(const char *refname,
> const unsigned char *sha1,
>   */
>  int ref_storage_backend_config(const char *var, const char *value,
> void *ptr);
>  
> -struct ref_storage_be;
> -
> -extern struct ref_storage_be refs_be_lmdb;
>  /*
>   * Switch to an alternate ref storage backend.
>   */
> @@ -525,8 +522,6 @@ int set_ref_storage_backend(const char *name);
>  
>  int ref_storage_backend_exists(const char *name);
>  
> -void register_ref_storage_backend(struct ref_storage_be *be);
> -
>  void register_ref_storage_backends(void);
>  
>  #endif /* REFS_H */
> diff --git a/refs/refs-internal.h b/refs/refs-internal.h
> index 0337d2e..ced6af4 100644
> --- a/refs/refs-internal.h
> +++ b/refs/refs-internal.h
> @@ -308,5 +308,8 @@ struct ref_storage_be {
>  };
>  
>  extern struct ref_storage_be refs_be_files;
> +#ifdef USE_LIBLMDB
> +extern struct ref_storage_be refs_be_lmdb;
> +#endif
>  
>  #endif /* REFS_REFS_INTERNAL_H */
> diff --git a/test-refs-lmdb-backend.c b/test-refs-lmdb-backend.c
> index 5cf61e6..9703e5a 100644
> --- a/test-refs-lmdb-backend.c
> +++ b/test-refs-lmdb-backend.c
> @@ -43,8 +43,9 @@ int main(int argc, const char **argv)
>  
>  	git_config(git_default_config, NULL);
>  
> -	register_ref_storage_backend(&refs_be_lmdb);
> -	set_ref_storage_backend("lmdb");
> +	register_ref_storage_backends();
> +	if (!set_ref_storage_backend("lmdb"))
> +		die("could not set lmdb reference backend");
>  
>  	if (clear_reflog) {
>  		test_refdb_raw_delete_reflog(argv[0]);
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]