util: Drop pointless NUL_TERMINATE macro

It's only used once and open coding it is at least as clear as using the
macro.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Jiri Denemark 2021-09-30 21:02:54 +02:00
parent 54cf221b55
commit b564ce40aa
2 changed files with 1 additions and 3 deletions

View File

@ -91,8 +91,6 @@
#define STREQ_NULLABLE(a, b) (g_strcmp0(a, b) == 0)
#define STRNEQ_NULLABLE(a, b) (g_strcmp0(a, b) != 0)
#define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] = '\0'; } while (0)
#ifdef WIN32
# ifndef O_CLOEXEC
# define O_CLOEXEC _O_NOINHERIT

View File

@ -485,7 +485,7 @@ virGetHostnameImpl(bool quiet)
"%s", _("failed to determine host name"));
return NULL;
}
NUL_TERMINATE(hostname);
hostname[sizeof(hostname) - 1] = '\0';
if (STRPREFIX(hostname, "localhost") || strchr(hostname, '.')) {
/* in this case, gethostname returned localhost (meaning we can't