From 7783f518f63f885808639374091ea5a67038c935 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Sun, 31 Dec 2006 10:02:58 +0000 Subject: extract some more common macros git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@208 ef36b2f9-881f-0410-afb5-c4e39611909c --- nss/hosts.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'nss') diff --git a/nss/hosts.c b/nss/hosts.c index 92aacf1..449506b 100644 --- a/nss/hosts.c +++ b/nss/hosts.c @@ -88,9 +88,7 @@ static enum nss_status read_hostent( /* Note: this may allocate too much memory (e.g. also for address records of other address families) but this is an easy way to do it */ - BUF_CHECK(fp,(numaddr+1)*sizeof(char *)); - result->h_addr_list=(char **)BUF_CUR; - BUF_SKIP((numaddr+1)*sizeof(char *)); + BUF_ALLOC(fp,result->h_addr_list,char *,numaddr+1); /* go through the address list and filter on af */ i=0; while (--numaddr>=0) @@ -100,12 +98,9 @@ static enum nss_status read_hostent( READ_INT32(fp,tmp2int32); if (readaf==af) { + /* read the address */ result->h_length=tmp2int32; - /* allocate room in buffer */ - BUF_CHECK(fp,tmp2int32); - READ(fp,BUF_CUR,(size_t)tmp2int32); - result->h_addr_list[i++]=BUF_CUR; - BUF_SKIP(tmp2int32); + READ_BUF(fp,result->h_addr_list[i++],tmp2int32); } else { -- cgit v1.2.3