From 25300b5a1fcf54674a69d0f4ab08925be00b0227 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 23 Aug 2015 14:30:52 +0200 Subject: util: make machine_name_is_valid() a macro and move it to hostname-util.h As it turns out machine_name_is_valid() does the exact same thing as hostname_is_valid() these days, as it just invoked that and checked the name length was < 64. However, hostname_is_valid() checks the length against HOST_NAME_MAX anyway (which is 64 on Linux), hence any additional check is redundant. We hence replace machine_name_is_valid() by a macro that simply maps it to hostname_is_valid() but sets the allow_trailing_dot parameter to false. We also move this this call to hostname-util.h, to the same place as the hostname_is_valid() declaration. --- src/basic/util.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'src/basic/util.c') diff --git a/src/basic/util.c b/src/basic/util.c index 9571f0ab12..deff68073c 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -3006,21 +3006,6 @@ char* strshorten(char *s, size_t l) { return s; } -bool machine_name_is_valid(const char *s) { - - if (!hostname_is_valid(s, false)) - return false; - - /* Machine names should be useful hostnames, but also be - * useful in unit names, hence we enforce a stricter length - * limitation. */ - - if (strlen(s) > 64) - return false; - - return true; -} - int pipe_eof(int fd) { struct pollfd pollfd = { .fd = fd, -- cgit v1.2.3-54-g00ecf