Skip to content

Commit

Permalink
utilities: Avoid inclusion of network headers
Browse files Browse the repository at this point in the history
No-OS applications most likely don't have <net/if.h>. This header was
included from dns_sd.h, which was included in utilities.c.

utilities.c only needed dns_sd.h for the FQDN_LEN macro; so move this
macro to network.h instead, which does not include any non-standard
headers.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
  • Loading branch information
pcercuei committed Jan 25, 2024
1 parent 5859fca commit b1c2984
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion dns_sd.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

/* IPv6 Max = 4*8 + 7 + 1 for '%' + interface length */
#define DNS_SD_ADDRESS_STR_MAX (40 + IF_NAMESIZE)
#define FQDN_LEN (255) /* RFC 1035 */

/* MacOS doesn't include ENOMEDIUM (No medium found) like Linux does */
#ifndef ENOMEDIUM
Expand Down
1 change: 1 addition & 0 deletions dns_sd_bonjour.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

#include "dns_sd.h"
#include "network.h" // for FQDN_LEN

#include <arpa/inet.h>
#include <netinet/in.h>
Expand Down
2 changes: 2 additions & 0 deletions network.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#include <stdbool.h>

#define FQDN_LEN (255) /* RFC 1035 */

struct iio_context_params;
struct iio_context_pdata;
struct addrinfo;
Expand Down
2 changes: 1 addition & 1 deletion utilities.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
/* Force the XSI version of strerror_r */
#undef _GNU_SOURCE

#include "dns_sd.h"
#include "iio-config.h"
#include "iio-private.h"
#include "network.h" // for FQDN_LEN

#include <errno.h>
#include <iio/iio-debug.h>
Expand Down

0 comments on commit b1c2984

Please sign in to comment.