From 814a25859a3c1c9b8ab1ada727a80ce182ffc118 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Fri, 21 Jun 2019 08:39:33 +0200 Subject: [PATCH] ripd: use MTYPE_STATIC Signed-off-by: David Lamparter --- ripd/rip_interface.c | 2 ++ ripd/rip_interface.h | 3 +++ ripd/rip_memory.c | 36 ------------------------------------ ripd/rip_memory.h | 37 ------------------------------------- ripd/rip_northbound.c | 1 + ripd/rip_offset.c | 2 ++ ripd/rip_peer.c | 2 ++ ripd/ripd.c | 6 ++++++ ripd/ripd.h | 4 +++- ripd/subdir.am | 2 -- 10 files changed, 19 insertions(+), 76 deletions(-) delete mode 100644 ripd/rip_memory.c delete mode 100644 ripd/rip_memory.h diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 634fee0b3..80561f350 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -43,6 +43,8 @@ #include "ripd/rip_debug.h" #include "ripd/rip_interface.h" +DEFINE_MTYPE_STATIC(RIPD, RIP_INTERFACE, "RIP interface") +DEFINE_MTYPE(RIPD, RIP_INTERFACE_STRING, "RIP Interface String") DEFINE_HOOK(rip_ifaddr_add, (struct connected * ifc), (ifc)) DEFINE_HOOK(rip_ifaddr_del, (struct connected * ifc), (ifc)) diff --git a/ripd/rip_interface.h b/ripd/rip_interface.h index 6befda0e2..715daf2e5 100644 --- a/ripd/rip_interface.h +++ b/ripd/rip_interface.h @@ -20,8 +20,11 @@ #ifndef _QUAGGA_RIP_INTERFACE_H #define _QUAGGA_RIP_INTERFACE_H +#include "memory.h" #include "zclient.h" +DECLARE_MTYPE(RIP_INTERFACE_STRING) + extern int rip_interface_down(int, struct zclient *, zebra_size_t, vrf_id_t); extern int rip_interface_up(int, struct zclient *, zebra_size_t, vrf_id_t); extern int rip_interface_add(int, struct zclient *, zebra_size_t, vrf_id_t); diff --git a/ripd/rip_memory.c b/ripd/rip_memory.c deleted file mode 100644 index 7d703a86d..000000000 --- a/ripd/rip_memory.c +++ /dev/null @@ -1,36 +0,0 @@ -/* ripd memory type definitions - * - * Copyright (C) 2015 David Lamparter - * - * This file is part of Quagga. - * - * Quagga is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * Quagga is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; see the file COPYING; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "rip_memory.h" - -DEFINE_MGROUP(RIPD, "ripd") -DEFINE_MTYPE(RIPD, RIP, "RIP structure") -DEFINE_MTYPE(RIPD, RIP_VRF_NAME, "RIP VRF name") -DEFINE_MTYPE(RIPD, RIP_INFO, "RIP route info") -DEFINE_MTYPE(RIPD, RIP_INTERFACE, "RIP interface") -DEFINE_MTYPE(RIPD, RIP_INTERFACE_STRING, "RIP Interface String") -DEFINE_MTYPE(RIPD, RIP_PEER, "RIP peer") -DEFINE_MTYPE(RIPD, RIP_OFFSET_LIST, "RIP offset list") -DEFINE_MTYPE(RIPD, RIP_DISTANCE, "RIP distance") diff --git a/ripd/rip_memory.h b/ripd/rip_memory.h deleted file mode 100644 index 1f9d8f500..000000000 --- a/ripd/rip_memory.h +++ /dev/null @@ -1,37 +0,0 @@ -/* ripd memory type declarations - * - * Copyright (C) 2015 David Lamparter - * - * This file is part of Quagga. - * - * Quagga is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * Quagga is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; see the file COPYING; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef _QUAGGA_RIP_MEMORY_H -#define _QUAGGA_RIP_MEMORY_H - -#include "memory.h" - -DECLARE_MGROUP(RIPD) -DECLARE_MTYPE(RIP) -DECLARE_MTYPE(RIP_VRF_NAME) -DECLARE_MTYPE(RIP_INFO) -DECLARE_MTYPE(RIP_INTERFACE) -DECLARE_MTYPE(RIP_INTERFACE_STRING) -DECLARE_MTYPE(RIP_PEER) -DECLARE_MTYPE(RIP_OFFSET_LIST) -DECLARE_MTYPE(RIP_DISTANCE) - -#endif /* _QUAGGA_RIP_MEMORY_H */ diff --git a/ripd/rip_northbound.c b/ripd/rip_northbound.c index f8a7f5dc6..1238d0f0f 100644 --- a/ripd/rip_northbound.c +++ b/ripd/rip_northbound.c @@ -33,6 +33,7 @@ #include "ripd/ripd.h" #include "ripd/rip_debug.h" #include "ripd/rip_cli.h" +#include "ripd/rip_interface.h" /* * XPath: /frr-ripd:ripd/instance diff --git a/ripd/rip_offset.c b/ripd/rip_offset.c index 8307a95d2..776f121d5 100644 --- a/ripd/rip_offset.c +++ b/ripd/rip_offset.c @@ -29,6 +29,8 @@ #include "ripd/ripd.h" +DEFINE_MTYPE_STATIC(RIPD, RIP_OFFSET_LIST, "RIP offset list") + #define OFFSET_LIST_IN_NAME(O) ((O)->direct[RIP_OFFSET_LIST_IN].alist_name) #define OFFSET_LIST_IN_METRIC(O) ((O)->direct[RIP_OFFSET_LIST_IN].metric) diff --git a/ripd/rip_peer.c b/ripd/rip_peer.c index 08aa61257..4ad7309c4 100644 --- a/ripd/rip_peer.c +++ b/ripd/rip_peer.c @@ -29,6 +29,8 @@ #include "ripd/ripd.h" +DEFINE_MTYPE_STATIC(RIPD, RIP_PEER, "RIP peer") + static struct rip_peer *rip_peer_new(void) { return XCALLOC(MTYPE_RIP_PEER, sizeof(struct rip_peer)); diff --git a/ripd/ripd.c b/ripd/ripd.c index 3a1ffd17a..e0ff0430f 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -51,6 +51,12 @@ /* UDP receive buffer size */ #define RIP_UDP_RCV_BUF 41600 +DEFINE_MGROUP(RIPD, "ripd") +DEFINE_MTYPE_STATIC(RIPD, RIP, "RIP structure") +DEFINE_MTYPE_STATIC(RIPD, RIP_VRF_NAME, "RIP VRF name") +DEFINE_MTYPE_STATIC(RIPD, RIP_INFO, "RIP route info") +DEFINE_MTYPE_STATIC(RIPD, RIP_DISTANCE, "RIP distance") + /* Prototypes. */ static void rip_output_process(struct connected *, struct sockaddr_in *, int, uint8_t); diff --git a/ripd/ripd.h b/ripd/ripd.h index 44f5932fb..7f2c3fd06 100644 --- a/ripd/ripd.h +++ b/ripd/ripd.h @@ -24,7 +24,7 @@ #include "hook.h" #include "nexthop.h" #include "distribute.h" -#include "rip_memory.h" +#include "memory.h" /* RIP version number. */ #define RIPv1 1 @@ -97,6 +97,8 @@ #define RIP_INSTANCE "/frr-ripd:ripd/instance" #define RIP_IFACE "/frr-interface:lib/interface/frr-ripd:rip" +DECLARE_MGROUP(RIPD) + /* RIP structure. */ struct rip { RB_ENTRY(rip) entry; diff --git a/ripd/subdir.am b/ripd/subdir.am index 2a63cc522..312c1db6a 100644 --- a/ripd/subdir.am +++ b/ripd/subdir.am @@ -23,7 +23,6 @@ ripd_librip_a_SOURCES = \ ripd/rip_debug.c \ ripd/rip_errors.c \ ripd/rip_interface.c \ - ripd/rip_memory.c \ ripd/rip_offset.c \ ripd/rip_northbound.c \ ripd/rip_peer.c \ @@ -40,7 +39,6 @@ noinst_HEADERS += \ ripd/rip_debug.h \ ripd/rip_errors.h \ ripd/rip_interface.h \ - ripd/rip_memory.h \ ripd/ripd.h \ # end -- 2.39.2