hlr: Export + Declare global g_hlr symbol

It is a global variable, and it's sort of bogus if every C file
re-declares it as a static global variable that is assigned to the
same value as the "real" global one during start-up.

Change-Id: I6f3e50f071fb2fbbe58413b4760dc2215055a444
diff --git a/src/hlr.c b/src/hlr.c
index 8732587..c38f13f 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -43,7 +43,7 @@
 #include "luop.h"
 #include "hlr_vty.h"
 
-static struct hlr *g_hlr;
+struct hlr *g_hlr;
 static int quit = 0;
 
 /* Trigger 'Insert Subscriber Data' messages to all connected GSUP clients.
@@ -569,7 +569,7 @@
 	vty_init(&vty_info);
 	ctrl_vty_init(hlr_ctx);
 	handle_options(argc, argv);
-	hlr_vty_init(g_hlr, &hlr_log_info);
+	hlr_vty_init(&hlr_log_info);
 
 	rc = vty_read_config_file(cmdline_opts.config_file, NULL);
 	if (rc < 0) {
diff --git a/src/hlr.h b/src/hlr.h
index 368a052..8f73806 100644
--- a/src/hlr.h
+++ b/src/hlr.h
@@ -39,6 +39,8 @@
 	char *gsup_bind_addr;
 };
 
+extern struct hlr *g_hlr;
+
 struct hlr_subscriber;
 
 void osmo_hlr_subscriber_update_notify(struct hlr_subscriber *subscr);
diff --git a/src/hlr_vty.c b/src/hlr_vty.c
index ecc2f5c..ae27975 100644
--- a/src/hlr_vty.c
+++ b/src/hlr_vty.c
@@ -32,8 +32,6 @@
 #include "hlr_vty_subscr.h"
 #include "gsup_server.h"
 
-static struct hlr *g_hlr = NULL;
-
 struct cmd_node hlr_node = {
 	HLR_NODE,
 	"%s(config-hlr)# ",
@@ -152,10 +150,8 @@
 	}
 }
 
-void hlr_vty_init(struct hlr *hlr, const struct log_info *cat)
+void hlr_vty_init(const struct log_info *cat)
 {
-	g_hlr = hlr;
-
 	logging_vty_add_cmds(cat);
 	osmo_talloc_vty_add_cmds();
 
@@ -169,5 +165,5 @@
 
 	install_element(GSUP_NODE, &cfg_hlr_gsup_bind_ip_cmd);
 
-	hlr_vty_subscriber_init(hlr);
+	hlr_vty_subscriber_init();
 }
diff --git a/src/hlr_vty.h b/src/hlr_vty.h
index cd2ff73..bc9c2e5 100644
--- a/src/hlr_vty.h
+++ b/src/hlr_vty.h
@@ -34,4 +34,4 @@
 
 int hlr_vty_is_config_node(struct vty *vty, int node);
 int hlr_vty_go_parent(struct vty *vty);
-void hlr_vty_init(struct hlr *hlr, const struct log_info *cat);
+void hlr_vty_init(const struct log_info *cat);
diff --git a/src/hlr_vty_subscr.c b/src/hlr_vty_subscr.c
index 4092a8f..9ee6948 100644
--- a/src/hlr_vty_subscr.c
+++ b/src/hlr_vty_subscr.c
@@ -33,8 +33,6 @@
 
 #define hexdump_buf(buf) osmo_hexdump_nospc((void*)buf, sizeof(buf))
 
-static struct hlr *g_hlr = NULL;
-
 static void subscr_dump_full_vty(struct vty *vty, struct hlr_subscriber *subscr)
 {
 	int rc;
@@ -476,10 +474,8 @@
 	return CMD_SUCCESS;
 }
 
-void hlr_vty_subscriber_init(struct hlr *hlr)
+void hlr_vty_subscriber_init(void)
 {
-	g_hlr = hlr;
-
 	install_element_ve(&subscriber_show_cmd);
 	install_element(ENABLE_NODE, &subscriber_create_cmd);
 	install_element(ENABLE_NODE, &subscriber_delete_cmd);
diff --git a/src/hlr_vty_subscr.h b/src/hlr_vty_subscr.h
index 841db5a..5dd0772 100644
--- a/src/hlr_vty_subscr.h
+++ b/src/hlr_vty_subscr.h
@@ -1,3 +1,3 @@
 #pragma once
 
-void hlr_vty_subscriber_init(struct hlr *hlr);
+void hlr_vty_subscriber_init(void);