Modify previous commit to solve the real problem that made gcc think

the timestamp was aligned.  ie: Use a void * instead of struct timeval *
which gcc assumes will be aligned.  Go back to memcpy().

Submitted by: bde
This commit is contained in:
Peter Wemm 2002-09-11 18:12:29 +00:00
parent 8b71896f96
commit 9d2b0ab82a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=103227

View File

@ -811,7 +811,7 @@ pr_pack(buf, cc, from, tv)
struct icmp *icp; struct icmp *icp;
struct ip *ip; struct ip *ip;
struct in_addr ina; struct in_addr ina;
struct timeval *tp; const void *tp;
u_char *cp, *dp; u_char *cp, *dp;
double triptime; double triptime;
int dupflag, hlen, i, j, seq; int dupflag, hlen, i, j, seq;
@ -839,12 +839,12 @@ pr_pack(buf, cc, from, tv)
if (timing) { if (timing) {
struct timeval tv1; struct timeval tv1;
#ifndef icmp_data #ifndef icmp_data
tp = (struct timeval *)&icp->icmp_ip; tp = &icp->icmp_ip;
#else #else
tp = (struct timeval *)icp->icmp_data; tp = icp->icmp_data;
#endif #endif
/* Avoid unaligned data (cannot use memcpy) */ /* Copy to avoid alignment problems: */
bcopy(tp, &tv1, sizeof(tv1)); memcpy(&tv1, tp, sizeof(tv1));
tvsub(tv, &tv1); tvsub(tv, &tv1);
triptime = ((double)tv->tv_sec) * 1000.0 + triptime = ((double)tv->tv_sec) * 1000.0 +
((double)tv->tv_usec) / 1000.0; ((double)tv->tv_usec) / 1000.0;