From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: danielk43 <11856117+danielk43@users.noreply.github.com> Date: Sun, 26 Mar 2023 11:37:26 -0400 Subject: [PATCH] Reuse align_ptr in hosts_cache Change-Id: I461718c38ca3c0e372e1cc0e0f0deb74ae5c68bb --- hosts_cache.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/hosts_cache.cpp b/hosts_cache.cpp index 258eac1..be8a0ff 100644 --- a/hosts_cache.cpp +++ b/hosts_cache.cpp @@ -47,10 +47,6 @@ constexpr int MAXADDRS = 35; #define ESTIMATED_LINELEN 32 #define HCFILE_ALLOC_SIZE 256 -/* From sethostent.c */ -#define ALIGNBYTES (sizeof(uintptr_t) - 1) -#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES) - /* * Host cache entry for hcfile.c_data. * Offsets are into hcfile.h_data. @@ -500,7 +496,7 @@ int hc_gethtbyname(const char *host, int af, struct getnamaddr *info) if (naliases >= MAXALIASES) goto nospc; } - aligned = (char *)ALIGN(info->buf); + aligned = align_ptr(info->buf); if (info->buf != aligned) { if ((ptrdiff_t)info->buflen < (aligned - info->buf)) goto nospc;