From 5d160a23041254f58acfd35584103df57dc347ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 16 Feb 2021 14:14:41 +0100 Subject: [PATCH] networkd: make network_config_section_free() inline --- src/network/networkd-util.c | 4 ---- src/network/networkd-util.h | 7 +++++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/network/networkd-util.c b/src/network/networkd-util.c index b41148d2c6..a5c6fa8d00 100644 --- a/src/network/networkd-util.c +++ b/src/network/networkd-util.c @@ -155,10 +155,6 @@ int network_config_section_new(const char *filename, unsigned line, NetworkConfi return 0; } -void network_config_section_free(NetworkConfigSection *cs) { - free(cs); -} - unsigned hashmap_find_free_section_line(Hashmap *hashmap) { NetworkConfigSection *cs; unsigned n = 0; diff --git a/src/network/networkd-util.h b/src/network/networkd-util.h index 0cfb009890..efeeb86eb0 100644 --- a/src/network/networkd-util.h +++ b/src/network/networkd-util.h @@ -47,9 +47,12 @@ sd_dhcp_lease_server_type dhcp_lease_server_type_from_string(const char *s) _pur int kernel_route_expiration_supported(void); -int network_config_section_new(const char *filename, unsigned line, NetworkConfigSection **s); -void network_config_section_free(NetworkConfigSection *network); +static inline void network_config_section_free(NetworkConfigSection *cs) { + free(cs); +} DEFINE_TRIVIAL_CLEANUP_FUNC(NetworkConfigSection*, network_config_section_free); + +int network_config_section_new(const char *filename, unsigned line, NetworkConfigSection **s); extern const struct hash_ops network_config_hash_ops; unsigned hashmap_find_free_section_line(Hashmap *hashmap);