tree-wide: Introduce DECLARE_TRIVIAL_REF_UNREF_FUNC() and friends

This commit is contained in:
Daan De Meyer
2026-01-02 04:04:19 +09:00
committed by Yu Watanabe
parent 11adc8bad5
commit daff8ea8bb
61 changed files with 109 additions and 144 deletions
+1 -2
View File
@@ -227,8 +227,7 @@ void netdev_drop(NetDev *netdev);
void netdev_enter_failed(NetDev *netdev);
int netdev_enter_ready(NetDev *netdev);
NetDev* netdev_unref(NetDev *netdev);
NetDev* netdev_ref(NetDev *netdev);
DECLARE_TRIVIAL_REF_UNREF_FUNC(NetDev, netdev);
DEFINE_TRIVIAL_DESTRUCTOR(netdev_destroy_callback, NetDev, netdev_unref);
DEFINE_TRIVIAL_CLEANUP_FUNC(NetDev*, netdev_unref);
+1 -2
View File
@@ -3,8 +3,7 @@
#include "networkd-forward.h"
IPv6Token* ipv6_token_ref(IPv6Token *token);
IPv6Token* ipv6_token_unref(IPv6Token *token);
DECLARE_TRIVIAL_REF_UNREF_FUNC(IPv6Token, ipv6_token);
int dhcp_pd_generate_addresses(Link *link, const struct in6_addr *prefix, Hashmap **ret);
int ndisc_generate_addresses(Link *link, const struct in6_addr *prefix, uint8_t prefixlen, Hashmap **ret);
+1 -2
View File
@@ -87,8 +87,7 @@ extern const struct hash_ops address_hash_ops;
bool address_can_update(const Address *existing, const Address *requesting);
Address* address_ref(Address *address);
Address* address_unref(Address *address);
DECLARE_TRIVIAL_REF_UNREF_FUNC(Address, address);
int address_new(Address **ret);
int address_new_static(Network *network, const char *filename, unsigned section_line, Address **ret);
+1 -2
View File
@@ -207,8 +207,7 @@ bool link_is_ready_to_configure_by_name(Manager *manager, const char *name, bool
void link_ntp_settings_clear(Link *link);
void link_dns_settings_clear(Link *link);
Link* link_unref(Link *link);
Link* link_ref(Link *link);
DECLARE_TRIVIAL_REF_UNREF_FUNC(Link, link);
DEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_unref);
DEFINE_TRIVIAL_DESTRUCTOR(link_netlink_destroy_callback, Link, link_unref);
+1 -2
View File
@@ -19,8 +19,7 @@ typedef struct Neighbor {
struct hw_addr_data ll_addr;
} Neighbor;
Neighbor* neighbor_ref(Neighbor *neighbor);
Neighbor* neighbor_unref(Neighbor *neighbor);
DECLARE_TRIVIAL_REF_UNREF_FUNC(Neighbor, neighbor);
int neighbor_get(Link *link, const Neighbor *in, Neighbor **ret);
int neighbor_remove(Neighbor *neighbor, Link *link);
+1 -2
View File
@@ -416,8 +416,7 @@ typedef struct Network {
char **ntp;
} Network;
Network *network_ref(Network *network);
Network *network_unref(Network *network);
DECLARE_TRIVIAL_REF_UNREF_FUNC(Network, network);
DEFINE_TRIVIAL_CLEANUP_FUNC(Network*, network_unref);
int network_load(Manager *manager, OrderedHashmap **ret);
+1 -2
View File
@@ -83,8 +83,7 @@ typedef struct Request {
bool waiting_reply;
} Request;
Request *request_ref(Request *req);
Request *request_unref(Request *req);
DECLARE_TRIVIAL_REF_UNREF_FUNC(Request, request);
DEFINE_TRIVIAL_CLEANUP_FUNC(Request*, request_unref);
void request_detach(Request *req);
+1 -2
View File
@@ -74,8 +74,7 @@ void log_route_debug(const Route *route, const char *str, Manager *manager);
extern const struct hash_ops route_hash_ops;
extern const struct hash_ops route_hash_ops_unref;
Route* route_ref(Route *route);
Route* route_unref(Route *route);
DECLARE_TRIVIAL_REF_UNREF_FUNC(Route, route);
DEFINE_SECTION_CLEANUP_FUNCTIONS(Route, route_unref);
void route_detach(Route *route);
+1 -2
View File
@@ -49,8 +49,7 @@ typedef struct RoutingPolicyRule {
int fr_act_type_from_string(const char *s) _pure_;
const char* fr_act_type_to_string(int t) _const_;
RoutingPolicyRule* routing_policy_rule_ref(RoutingPolicyRule *rule);
RoutingPolicyRule* routing_policy_rule_unref(RoutingPolicyRule *rule);
DECLARE_TRIVIAL_REF_UNREF_FUNC(RoutingPolicyRule, routing_policy_rule);
void network_drop_invalid_routing_policy_rules(Network *network);
+1 -2
View File
@@ -74,8 +74,7 @@ extern const QDiscVTable * const qdisc_vtable[_QDISC_KIND_MAX];
DEFINE_NETWORK_CONFIG_STATE_FUNCTIONS(QDisc, qdisc);
QDisc* qdisc_ref(QDisc *qdisc);
QDisc* qdisc_unref(QDisc *qdisc);
DECLARE_TRIVIAL_REF_UNREF_FUNC(QDisc, qdisc);
int qdisc_new_static(QDiscKind kind, Network *network, const char *filename, unsigned section_line, QDisc **ret);
void qdisc_mark_recursive(QDisc *qdisc);
+1 -2
View File
@@ -53,8 +53,7 @@ extern const TClassVTable * const tclass_vtable[_TCLASS_KIND_MAX];
DEFINE_NETWORK_CONFIG_STATE_FUNCTIONS(TClass, tclass);
TClass* tclass_ref(TClass *tclass);
TClass* tclass_unref(TClass *tclass);
DECLARE_TRIVIAL_REF_UNREF_FUNC(TClass, tclass);
int tclass_new_static(TClassKind kind, Network *network, const char *filename, unsigned section_line, TClass **ret);
void tclass_mark_recursive(TClass *tclass);