On some specific cases, the user may wish not to export its memory
type and group. The user can then declare and initialises this
memory type, provided that he ensures also the initialisation. The
goal of that commit is initialising in quagga the static mtypes.

Signed-off-by: Philippe Guibert <philippe.guib...@6wind.com>
---
 bgpd/bgp_nexthop.c          | 2 ++
 ospf6d/ospf6_interface.c    | 2 ++
 ospfclient/ospf_apiclient.c | 2 ++
 ospfd/ospf_opaque.c         | 9 +++++++++
 ospfd/ospf_te.c             | 8 ++++++++
 tests/heavy-wq.c            | 3 +++
 tests/test-memory.c         | 2 ++
 vtysh/vtysh_config.c        | 4 ++++
 8 files changed, 32 insertions(+)

diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index 364d6e924e68..117083cbd3b0 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -1393,6 +1393,8 @@ bgp_config_write_scan_time (struct vty *vty)
 void
 bgp_scan_init (void)
 {
+  INIT_MTYPE(BGP_NEXTHOP);
+
   zlookup = zclient_new (bm->master);
   zlookup->sock = -1;
   zlookup->t_connect = thread_add_event (bm->master, zlookup_connect, zlookup, 
0);
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index d03ae76d5e94..32c1b7271a4c 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -1865,6 +1865,8 @@ static struct cmd_node interface_node =
 void
 ospf6_interface_init (void)
 {
+  INIT_MTYPE(CFG_PLIST_NAME);
+
   /* Install interface node. */
   install_node (&interface_node, config_write_ospf6_interface);
 
diff --git a/ospfclient/ospf_apiclient.c b/ospfclient/ospf_apiclient.c
index 453e05ce2ebb..799d63f0c203 100644
--- a/ospfclient/ospf_apiclient.c
+++ b/ospfclient/ospf_apiclient.c
@@ -99,6 +99,8 @@ ospf_apiclient_connect (char *host, int syncport)
   int ret;
   int on = 1;
 
+  INIT_MTYPE(OSPF_APICLIENT);
+
   /* There are two connections between the client and the server.
      First the client opens a connection for synchronous requests/replies 
      to the server. The server will accept this connection and
diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c
index fa7b2de8f432..2c2971b47d24 100644
--- a/ospfd/ospf_opaque.c
+++ b/ospfd/ospf_opaque.c
@@ -69,6 +69,7 @@ void ospf_apiserver_term (void);
 int ospf_apiserver_enable;
 #endif /* SUPPORT_OSPF_API */
 
+static void ospf_opaque_memory_init ();
 static void ospf_opaque_register_vty (void);
 static void ospf_opaque_funclist_init (void);
 static void ospf_opaque_funclist_term (void);
@@ -77,9 +78,17 @@ static void free_opaque_info_per_id (void *val);
 static int ospf_opaque_lsa_install_hook (struct ospf_lsa *lsa);
 static int ospf_opaque_lsa_delete_hook (struct ospf_lsa *lsa);
 
+static void ospf_opaque_memory_init(void)
+{
+  INIT_MTYPE(OSPF_OPAQUE_FUNCTAB);
+  INIT_MTYPE(OPAQUE_INFO_PER_TYPE);
+  INIT_MTYPE(OPAQUE_INFO_PER_ID); 
+}
+
 void
 ospf_opaque_init (void)
 {
+  ospf_opaque_memory_init ();
   ospf_opaque_register_vty ();
   ospf_opaque_funclist_init ();
 
diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c
index 04496ef21ce2..a02715e1bf0c 100644
--- a/ospfd/ospf_te.c
+++ b/ospfd/ospf_te.c
@@ -119,6 +119,7 @@ enum sched_opcode {
  * Followings are initialize/terminate functions for MPLS-TE handling.
  *------------------------------------------------------------------------*/
 
+static void ospf_mpls_te_memory_init(void);
 static int ospf_mpls_te_new_if (struct interface *ifp);
 static int ospf_mpls_te_del_if (struct interface *ifp);
 static void ospf_mpls_te_ism_change (struct ospf_interface *oi, int 
old_status);
@@ -133,11 +134,18 @@ static void ospf_mpls_te_lsa_schedule (struct 
mpls_te_link *lp, enum sched_opcod
 static void del_mpls_te_link (void *val);
 static void ospf_mpls_te_register_vty (void);
 
+static void ospf_mpls_te_memory_init(void)
+{
+  INIT_MTYPE(OSPF_MPLS_TE_LINKPARAMS);
+}
+
 int
 ospf_mpls_te_init (void)
 {
   int rc;
 
+  ospf_mpls_te_memory_init();
+
   rc = ospf_register_opaque_functab (
                 OSPF_OPAQUE_AREA_LSA,
                 OPAQUE_TYPE_TRAFFIC_ENGINEERING_LSA,
diff --git a/tests/heavy-wq.c b/tests/heavy-wq.c
index 2d15dc37bdeb..fc836150da7c 100644
--- a/tests/heavy-wq.c
+++ b/tests/heavy-wq.c
@@ -179,6 +179,9 @@ heavy_wq_init ()
 void
 test_init()
 {
+  INIT_MTYPE(WQ_NODE);
+  INIT_MTYPE(WQ_NODE_STR);
+
   install_element (VIEW_NODE, &clear_foo_cmd);
   heavy_wq_init();
 }
diff --git a/tests/test-memory.c b/tests/test-memory.c
index 6849b9dcebef..da623f885a70 100644
--- a/tests/test-memory.c
+++ b/tests/test-memory.c
@@ -51,6 +51,8 @@ main(int argc, char **argv)
   void *a[10];
   int i;
 
+  INIT_MTYPE(TEST);
+
   printf ("malloc x, malloc x, free, malloc x, free free\n\n");
   /* simple case, test cache */
   for (i = 0; i < TIMES; i++)
diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c
index f19fe0b86bc5..1866f376d027 100644
--- a/vtysh/vtysh_config.c
+++ b/vtysh/vtysh_config.c
@@ -438,6 +438,10 @@ vtysh_config_write ()
 void
 vtysh_config_init ()
 {
+  INIT_MGROUP(MVTYSH);
+  INIT_MTYPE(VTYSH_CONFIG);
+  INIT_MTYPE(VTYSH_CONFIG_LINE);
+
   config_top = list_new ();
   config_top->del = (void (*) (void *))line_del;
   configvec = vector_init (1);
-- 
2.1.4


_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to