git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] lmdb: restrict the visibility of some symbols
@ 2016-02-22 16:41 Ramsay Jones
  2016-02-22 20:56 ` David Turner
  0 siblings, 1 reply; 2+ messages in thread
From: Ramsay Jones @ 2016-02-22 16:41 UTC (permalink / raw)
  To: David Turner; +Cc: Junio C Hamano, GIT Mailing-list


Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---

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]);
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RFC PATCH] lmdb: restrict the visibility of some symbols
  2016-02-22 16:41 [RFC PATCH] lmdb: restrict the visibility of some symbols Ramsay Jones
@ 2016-02-22 20:56 ` David Turner
  0 siblings, 0 replies; 2+ messages in thread
From: David Turner @ 2016-02-22 20:56 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list

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@ramsayjones.plus.com>
> ---
> 
> 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]);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-22 20:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22 16:41 [RFC PATCH] lmdb: restrict the visibility of some symbols Ramsay Jones
2016-02-22 20:56 ` David Turner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).