Skip to content

Commit

Permalink
dns-sd: Move dnssd_free_discovery_data() to dns_sd.c
Browse files Browse the repository at this point in the history
There is no need to have one version per implementation.

Signed-off-by: Paul Cercueil <[email protected]>
  • Loading branch information
pcercuei committed May 11, 2021
1 parent c32fab4 commit 1d42fa3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 22 deletions.
7 changes: 7 additions & 0 deletions dns_sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
#define close(s) closesocket(s)
#endif

static void dnssd_free_discovery_data(struct dns_sd_discovery_data *d)
{
free(d->hostname);
free(d->address);
free(d);
}

/* Some functions for handling common linked list operations */
static void dnssd_remove_node(struct dns_sd_discovery_data **ddata, int n)
{
Expand Down
3 changes: 0 additions & 3 deletions dns_sd.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ int create_socket(const struct addrinfo *addrinfo);
/* Resolves all IIO hosts on the available networks, and passes back a linked list */
int dnssd_find_hosts(struct dns_sd_discovery_data ** ddata);

/* Frees memory of one entry on the list */
void dnssd_free_discovery_data(struct dns_sd_discovery_data *d);

/* Deallocates complete list of discovery data */
void dnssd_free_all_discovery_data(struct dns_sd_discovery_data *d);

Expand Down
7 changes: 0 additions & 7 deletions dns_sd_avahi.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ static int new_discovery_data(struct dns_sd_discovery_data **data)
return 0;
}

void dnssd_free_discovery_data(struct dns_sd_discovery_data *d)
{
free(d->hostname);
free(d->address);
free(d);
}

static void avahi_process_resolved(struct dns_sd_discovery_data *ddata, const AvahiAddress *addr,
const char *host_name, const uint16_t port)
{
Expand Down
6 changes: 0 additions & 6 deletions dns_sd_bonjour.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ static int new_discovery_data(struct dns_sd_discovery_data **data)
return 0;
}

void dnssd_free_discovery_data(struct dns_sd_discovery_data *d)
{
free(d->hostname);
free(d);
}

static void __cfnet_browser_cb (
CFNetServiceBrowserRef browser,
CFOptionFlags flags,
Expand Down
6 changes: 0 additions & 6 deletions dns_sd_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ static int new_discovery_data(struct dns_sd_discovery_data** data)
return 0;
}

void dnssd_free_discovery_data(struct dns_sd_discovery_data* d)
{
free(d->hostname);
free(d);
}

static int
open_client_sockets(int* sockets, int max_sockets) {
// When sending, each socket can only send to one network interface
Expand Down

0 comments on commit 1d42fa3

Please sign in to comment.