From 4b86e44abb166d32363ddf082680dee418d0e8ca Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 28 Jan 2000 01:57:42 +0000 Subject: [PATCH] define LWRES_ALIGN --- lib/lwres/gethost.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/lwres/gethost.c b/lib/lwres/gethost.c index ef038bac13..c86433355d 100644 --- a/lib/lwres/gethost.c +++ b/lib/lwres/gethost.c @@ -1,8 +1,12 @@ #include #include #include +#include #include -#include /* ALIGN */ + +#define LWRES_ALIGNBYTES (sizeof(char *) - 1) +#define LWRES_ALIGN(p) \ + (((unsigned int)(p) + LWRES_ALIGNBYTES) &~ LWRES_ALIGNBYTES) static struct hostent *he = NULL; static int copytobuf(struct hostent *, struct hostent *, char *, int); @@ -130,7 +134,7 @@ copytobuf(struct hostent *he, struct hostent *hptr, char *buf, int buflen) { /* Find out the amount of space required to store the answer. */ nptr = 2; /* NULL ptrs */ - len = (char *)ALIGN(buf) - buf; + len = (char *)LWRES_ALIGN(buf) - buf; for (i = 0; he->h_addr_list[i]; i++, nptr++) { len += he->h_length; } @@ -148,8 +152,8 @@ copytobuf(struct hostent *he, struct hostent *hptr, char *buf, int buflen) { hptr->h_addrtype = he->h_addrtype; n = hptr->h_length = he->h_length; - ptr = (char **)ALIGN(buf); - cp = (char *)ALIGN(buf) + nptr * sizeof(char *); + ptr = (char **)LWRES_ALIGN(buf); + cp = (char *)LWRES_ALIGN(buf) + nptr * sizeof(char *); /* copy address list */ hptr->h_addr_list = ptr;