From: Darafei Praliaskouski Date: Fri, 8 May 2026 12:09:57 +0000 (+0400) Subject: refactor(dns): share hostname usefulness helper X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=refs%2Fpull%2F618%2Fhead;p=thirdparty%2Fmtr.git refactor(dns): share hostname usefulness helper --- diff --git a/ui/dns.c b/ui/dns.c index f0551af..9641056 100644 --- a/ui/dns.c +++ b/ui/dns.c @@ -114,13 +114,6 @@ static void set_sockaddr_ip( memcpy(sockaddr_addr_offset(sa), ip, sockaddr_addr_size(sa)); } -static int is_useful_hostname( - const char *hostname) -{ - return hostname[0] != '\0' - && !(hostname[0] == '.' && hostname[1] == '\0'); -} - void dns_open( void) { diff --git a/ui/report.c b/ui/report.c index 7a1c582..151716b 100644 --- a/ui/report.c +++ b/ui/report.c @@ -47,14 +47,6 @@ #define MAX_FORMAT_STR 320 -static int is_useful_hostname( - const char *hostname) -{ - return hostname && hostname[0] != '\0' - && !(hostname[0] == '.' && hostname[1] == '\0'); -} - - void report_open( void) { diff --git a/ui/utils.h b/ui/utils.h index 3aa7267..fabd523 100644 --- a/ui/utils.h +++ b/ui/utils.h @@ -40,6 +40,13 @@ static inline void xstrncpy( dest[n - 1] = 0; } +static inline int is_useful_hostname( + const char *hostname) +{ + return hostname && hostname[0] != '\0' + && !(hostname[0] == '.' && hostname[1] == '\0'); +} + extern void *xmalloc( const size_t size); extern char *xstrdup(