summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
Diffstat (limited to 'shared')
-rw-r--r--shared/utils.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/shared/utils.h b/shared/utils.h
index 0fc1429..d0142b1 100644
--- a/shared/utils.h
+++ b/shared/utils.h
@@ -34,6 +34,8 @@ extern unsigned debug_mask;
#endif
#endif
+#define STRLEN(x) (sizeof(""x"") - 1)
+
#include "list.h"
#include "debug.h"
#include "external.h"
@@ -41,11 +43,11 @@ extern unsigned debug_mask;
/* Length of longest DNS name = 253 + trailing dot */
#define FQDN_STR_LEN 254
-/* Length of longest port string = strlen("65535") */
-#define PORT_STR_LEN 5
+/* Length of longest port string */
+#define PORT_STR_LEN STRLEN("65535")
-/* Length of longest address family string = strlen("AF_INETX") */
-#define AF_STR_LEN 8
+/* Length of longest address family string */
+#define AF_STR_LEN STRLEN("AF_INETX")
/* Length of longest addrstr, format = "AF_INETX <IPADDR> <PORT> */
#define ADDRSTRLEN (AF_STR_LEN + 1 + INET6_ADDRSTRLEN + 1 + PORT_STR_LEN + 1)