Skip to content

Commit

Permalink
somewhat safer typecasting in case sizeof(long) != sizeof(void *) (is…
Browse files Browse the repository at this point in the history
… there

even such platforms?)
  • Loading branch information
bagder committed Apr 12, 2004
1 parent 0fd3b7a commit eb6345d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/hostip.c
Expand Up @@ -1012,11 +1012,11 @@ static struct hostent* pack_hostent(char** buf, struct hostent* orig)

/* now, shrink the allocated buffer to the size we actually need, which
most often is only a fraction of the original alloc */
newbuf=(char *)realloc(*buf, (long)bufptr-(long)(*buf));
newbuf=(char *)realloc(*buf, (long)(bufptr-*buf));

/* if the alloc moved, we need to adjust things again */
if(newbuf != *buf)
hostcache_fixoffset((struct hostent*)newbuf, (long)newbuf-(long)*buf);
hostcache_fixoffset((struct hostent*)newbuf, (long)(newbuf-*buf));

/* setup the return */
*buf = newbuf;
Expand Down

0 comments on commit eb6345d

Please sign in to comment.