From 8565d9fc53214645f46e329e2e6bf9eb21e5a636 Mon Sep 17 00:00:00 2001 From: Darafei Praliaskouski Date: Fri, 8 May 2026 16:09:57 +0400 Subject: [PATCH] refactor(dns): share hostname usefulness helper --- ui/dns.c | 7 ------- ui/report.c | 8 -------- ui/utils.h | 7 +++++++ 3 files changed, 7 insertions(+), 15 deletions(-) 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( -- 2.47.3