From cf34ecc24c0baacf9ed6590ac703e1c6664f0cbc Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 11 Jan 2022 14:33:34 -0500 Subject: [PATCH] TT#156900 rename functions to avoid namespace conflict Change-Id: I676e35319518b468ed72da2dd58db7ec3ca33ea1 --- daemon/call.c | 2 +- daemon/control_ng.c | 2 +- lib/socket.c | 12 ++++++------ lib/socket.h | 13 +++++++------ 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 4ebc49f97..ce001de68 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -572,7 +572,7 @@ void call_timer(void *ptr) { last_run = tv_start; ZERO(hlp); - hlp.addr_sfd = g_hash_table_new(g_endpoint_hash, g_endpoint_eq); + hlp.addr_sfd = g_hash_table_new(endpoint_t_hash, endpoint_t_eq); ITERATE_CALL_LIST_START(CALL_ITERATOR_TIMER, c); call_timer_iterator(c, &hlp); diff --git a/daemon/control_ng.c b/daemon/control_ng.c index f30252abc..9fa31f0ac 100644 --- a/daemon/control_ng.c +++ b/daemon/control_ng.c @@ -589,7 +589,7 @@ void notify_ng_tcp_clients(str *data) { void control_ng_init() { mutex_init(&rtpe_cngs_lock); - rtpe_cngs_hash = g_hash_table_new(g_sockaddr_hash, g_sockaddr_eq); + rtpe_cngs_hash = g_hash_table_new(sockaddr_t_hash, sockaddr_t_eq); cookie_cache_init(&ng_cookie_cache); } void control_ng_cleanup() { diff --git a/lib/socket.c b/lib/socket.c index 5465b6a92..a23966852 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -469,13 +469,13 @@ static unsigned int __ip6_packet_header(unsigned char *out, const endpoint_t *sr unsigned int sockaddr_hash(const sockaddr_t *a) { return a->family->hash(a) ^ g_direct_hash(a->family); } -int sockaddr_eq(const sockaddr_t *a, const sockaddr_t *b) { +bool sockaddr_eq(const sockaddr_t *a, const sockaddr_t *b) { return a->family == b->family && a->family->eq(a, b); } -unsigned int g_sockaddr_hash(const void *a) { +guint sockaddr_t_hash(gconstpointer a) { return sockaddr_hash(a); } -int g_sockaddr_eq(const void *a, const void *b) { +gint sockaddr_t_eq(gconstpointer a, gconstpointer b) { return sockaddr_eq(a, b); } @@ -483,13 +483,13 @@ int g_sockaddr_eq(const void *a, const void *b) { unsigned int endpoint_hash(const endpoint_t *a) { return sockaddr_hash(&a->address) ^ a->port; } -int endpoint_eq(const endpoint_t *a, const endpoint_t *b) { +bool endpoint_eq(const endpoint_t *a, const endpoint_t *b) { return sockaddr_eq(&a->address, &b->address) && a->port == b->port; } -unsigned int g_endpoint_hash(const void *a) { +guint endpoint_t_hash(gconstpointer a) { return endpoint_hash(a); } -int g_endpoint_eq(const void *a, const void *b) { +gint endpoint_t_eq(gconstpointer a, const void *b) { return endpoint_eq(a, b); } diff --git a/lib/socket.h b/lib/socket.h index 89f7c3e62..a90187b1f 100644 --- a/lib/socket.h +++ b/lib/socket.h @@ -8,6 +8,7 @@ #include #include #include +#include @@ -230,14 +231,14 @@ void endpoint_parse_sockaddr_storage(endpoint_t *, struct sockaddr_storage *); void kernel2endpoint(endpoint_t *ep, const struct re_address *ra); unsigned int sockaddr_hash(const sockaddr_t *); -int sockaddr_eq(const sockaddr_t *, const sockaddr_t *); /* true/false */ -unsigned int g_sockaddr_hash(const void *); -int g_sockaddr_eq(const void *, const void *); /* true/false */ +bool sockaddr_eq(const sockaddr_t *, const sockaddr_t *); +guint sockaddr_t_hash(gconstpointer); // for glib +gint sockaddr_t_eq(gconstpointer, gconstpointer); // true/false, for glib unsigned int endpoint_hash(const endpoint_t *); -int endpoint_eq(const endpoint_t *, const endpoint_t *); /* true/false */ -unsigned int g_endpoint_hash(const void *); -int g_endpoint_eq(const void *, const void *); /* true/false */ +bool endpoint_eq(const endpoint_t *, const endpoint_t *); /* true/false */ +guint endpoint_t_hash(gconstpointer); // for glib +gint endpoint_t_eq(gconstpointer, gconstpointer); // true/false, for glib INLINE sockfamily_t *get_socket_family_enum(enum socket_families i) { if (i >= __SF_LAST)