about summary refs log tree commit diff
path: root/resolv/res_send.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-06-13 21:05:42 +0000
committerUlrich Drepper <drepper@redhat.com>2003-06-13 21:05:42 +0000
commit2533775393adba65535482cf3a6277774231677d (patch)
tree136df37bbdf4b2793575e4853fa0ce3521ada388 /resolv/res_send.c
parent309695129a603c3dd0541d1dc542b83d30445c84 (diff)
downloadglibc-2533775393adba65535482cf3a6277774231677d.tar.gz
glibc-2533775393adba65535482cf3a6277774231677d.tar.xz
glibc-2533775393adba65535482cf3a6277774231677d.zip
Update.
2003-06-13  Ulrich Drepper  <drepper@redhat.com>

	Fixing gcc 3.3 warnings, part II.
	* argp/argp-help.c (hol_entry_long_iterate): Always inline.
	* elf/dl-load.c (cache_rpath): Don't inline.
	* iconvdata/cns11642l2.h: Always inline all functions.
	* iconvdata/iso-ir-165.h: Likewise.
	* locale/Makefile (aux): Add coll-lookup.
	* locale/coll-lookup.c: New file.
	* locale/coll-lookup.h (collidx_table_lookup): Do not define here.
	(collseq_table_lookup): Likewise.
	* locale/weightwc.h: Adjust collidx_table_lookup calls for name change.
	* posix/fnmatch_loop.c: Adjust collseq_table_lookup calls for name
	change.
	* posix/regcomp.c: Likewise.
	* posix/regexec.c: Likewise.
	* locale/programs/3level.h (*_get): Always inline.
	* locale/programs/locfile.h: Move definition of handle_copy to...
	* locale/programs/locfile.c: ...here.
	* locale/programs/ld-collate.c (obstack_int32_grow): Always inline.
	(obstack_int32_grow_fast): Likewise.
	(utf8_encode): Likewise.
	(find_element): Avoid aliasing problems.
	(insert_value): Likewise.
	(collate_read): Likewise.
	* nss/getent.c (print_hosts): Don't inline
	(print_networks): Likewise.
	(print_shadow): Likewise.
	(build_doc): Likewise.
	* nss/nss_files/files-parse.c [ENTDATA] (parser_stclass): Don't
	inline.
	* posix/regcomp.c (re_set_fastmap): Always inline.
	(seek_collating_symbol_entry): Likewise.
	(lookup_collation_sequence_value): Likewise.
	(build_range_exp): Likewise.
	(build_collating_symbol): Likewise.
	* posix/regexec.c (acquire_init_state_context): Don't inline.
	(clean_state_log_if_need): Likewise.
	* resolv/res_send.c (eConsIovec): Rewrite to not return struct and
	adjust all callers.
	(evConsTime): Likewise.
	(evAddTime): Likewise.
	(evSubTime): Likewise.
	(evNowTime): Likewise.
	(evTimeSpec): Removed.
	(__libc_res_nsend): Avoid aliasing problem.
	* sysdeps/unix/sysv/linux/ifreq.h: Move old_siocgifconf definition to..
	* sysdeps/unix/sysv/linux/ifreq.c: ...here.
	* sysdeps/unix/sysv/linux/i386/dl-procinfo.h (_dl_string_hwcap):
	Always inline.
	(_dl_string_platform): Likewise.
	* wctype/wchar-lookup.h (wctype_table_lookup): Always inline.
	(wcwidth_table_lookup): Likewise.
	(wctrans_table_lookup): Likewise.

	* sysdeps/unix/sysv/linux/sys/epoll.h: Include <stdint.h>.
Diffstat (limited to 'resolv/res_send.c')
-rw-r--r--resolv/res_send.c108
1 files changed, 48 insertions, 60 deletions
diff --git a/resolv/res_send.c b/resolv/res_send.c
index d237c9a537..19adc3e103 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -108,63 +108,46 @@ static const char rcsid[] = "$BINDId: res_send.c,v 8.38 2000/03/30 20:16:51 vixi
 
 /* From ev_streams.c.  */
 
-static inline struct iovec
-evConsIovec(void *buf, size_t cnt) {
-	struct iovec ret;
-
-	memset(&ret, 0xf5, sizeof ret);
-	ret.iov_base = buf;
-	ret.iov_len = cnt;
-	return (ret);
+static inline void
+__attribute ((always_inline))
+evConsIovec(void *buf, size_t cnt, struct iovec *vec) {
+	memset(vec, 0xf5, sizeof (*vec));
+	vec->iov_base = buf;
+	vec->iov_len = cnt;
 }
 
 /* From ev_timers.c.  */
 
 #define BILLION 1000000000
 
-static inline struct timespec
-evTimeSpec(struct timeval tv) {
-        struct timespec ts;
-
-        ts.tv_sec = tv.tv_sec;
-        ts.tv_nsec = tv.tv_usec * 1000;
-        return (ts);
-}
-
-static inline struct timespec
-evConsTime(time_t sec, long nsec) {
-	struct timespec x;
-
-	x.tv_sec = sec;
-	x.tv_nsec = nsec;
-	return (x);
+static inline void
+evConsTime(struct timespec *res, time_t sec, long nsec) {
+	res->tv_sec = sec;
+	res->tv_nsec = nsec;
 }
 
-static inline struct timespec
-evAddTime(struct timespec addend1, struct timespec addend2) {
-	struct timespec x;
-
-	x.tv_sec = addend1.tv_sec + addend2.tv_sec;
-	x.tv_nsec = addend1.tv_nsec + addend2.tv_nsec;
-	if (x.tv_nsec >= BILLION) {
-		x.tv_sec++;
-		x.tv_nsec -= BILLION;
+static inline void
+evAddTime(struct timespec *res, const struct timespec *addend1,
+	  const struct timespec *addend2) {
+	res->tv_sec = addend1->tv_sec + addend2->tv_sec;
+	res->tv_nsec = addend1->tv_nsec + addend2->tv_nsec;
+	if (res->tv_nsec >= BILLION) {
+		res->tv_sec++;
+		res->tv_nsec -= BILLION;
 	}
-	return (x);
 }
 
-static inline struct timespec
-evSubTime(struct timespec minuend, struct timespec subtrahend) {
-	struct timespec x;
-
-	x.tv_sec = minuend.tv_sec - subtrahend.tv_sec;
-	if (minuend.tv_nsec >= subtrahend.tv_nsec)
-		x.tv_nsec = minuend.tv_nsec - subtrahend.tv_nsec;
+static inline void
+evSubTime(struct timespec *res, const struct timespec *minuend,
+	  const struct timespec *subtrahend) {
+       res->tv_sec = minuend->tv_sec - subtrahend->tv_sec;
+	if (minuend->tv_nsec >= subtrahend->tv_nsec)
+		res->tv_nsec = minuend->tv_nsec - subtrahend->tv_nsec;
 	else {
-		x.tv_nsec = BILLION - subtrahend.tv_nsec + minuend.tv_nsec;
-		x.tv_sec--;
+		res->tv_nsec = (BILLION
+				- subtrahend->tv_nsec + minuend->tv_nsec);
+		res->tv_sec--;
 	}
-	return (x);
 }
 
 static inline int
@@ -176,13 +159,14 @@ evCmpTime(struct timespec a, struct timespec b) {
 	return (x < 0L ? (-1) : x > 0L ? (1) : (0));
 }
 
-static inline struct timespec
-evNowTime() {
+static inline void
+evNowTime(struct timespec *res) {
 	struct timeval now;
 
 	if (gettimeofday(&now, NULL) < 0)
-		return (evConsTime(0, 0));
-	return (evTimeSpec(now));
+		evConsTime(res, 0, 0);
+	else
+		TIMEVAL_TO_TIMESPEC (&now, res);
 }
 
 #endif
@@ -561,9 +545,11 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
 				res_sendhookact act;
 
 #ifdef _LIBC
-				act = (*statp->qhook)((struct sockaddr_in **)
-						      &nsap, &buf, &buflen,
+				struct sockaddr_in *nsap4;
+				nsap4 = (struct sockaddr_in *) nsap;
+				act = (*statp->qhook)(&nsap4, &buf, &buflen,
 						      ans, anssiz, &resplen);
+				nsap = (struct sockaddr_in6 *) nsap4;
 #else
 				act = (*statp->qhook)(&nsap, &buf, &buflen,
 						      ans, anssiz, &resplen);
@@ -768,9 +754,10 @@ send_vc(res_state statp,
 	 * Send length & message
 	 */
 	putshort((u_short)buflen, (u_char*)&len);
-	iov[0] = evConsIovec(&len, INT16SZ);
-	iov[1] = evConsIovec((void*)buf, buflen);
-	if (writev(statp->_vcsock, iov, 2) != (INT16SZ + buflen)) {
+	evConsIovec(&len, INT16SZ, &iov[0]);
+	evConsIovec((void*)buf, buflen, &iov[1]);
+	if (TEMP_FAILURE_RETRY (writev(statp->_vcsock, iov, 2))
+	    != (INT16SZ + buflen)) {
 		*terrno = errno;
 		Perror(statp, stderr, "write failed", errno);
 		res_nclose(statp);
@@ -782,7 +769,8 @@ send_vc(res_state statp,
  read_len:
 	cp = ans;
 	len = INT16SZ;
-	while ((n = read(statp->_vcsock, (char *)cp, (int)len)) > 0) {
+	while ((n = TEMP_FAILURE_RETRY (read(statp->_vcsock, (char *)cp,
+					     (int)len))) > 0) {
 		cp += n;
 		if ((len -= n) <= 0)
 			break;
@@ -998,9 +986,9 @@ send_dg(res_state statp,
 		seconds /= statp->nscount;
 	if (seconds <= 0)
 		seconds = 1;
-	now = evNowTime();
-	timeout = evConsTime(seconds, 0);
-	finish = evAddTime(now, timeout);
+	evNowTime(&now);
+	evConsTime(&timeout, seconds, 0);
+	evAddTime(&finish, &now, &timeout);
  wait:
 #ifdef _LIBC
         /* Convert struct timespec in milliseconds.  */
@@ -1021,9 +1009,9 @@ send_dg(res_state statp,
 	}
 	if (n < 0) {
 		if (errno == EINTR) {
-			now = evNowTime();
+			evNowTime(&now);
 			if (evCmpTime(finish, now) > 0) {
-				timeout = evSubTime(finish, now);
+				evSubTime(&timeout, &finish, &now);
 				goto wait;
 			}
 		}
@@ -1244,7 +1232,7 @@ pselect(int nfds, void *rfds, void *wfds, void *efds,
 	if (sigmask)
 		sigprocmask(SIG_SETMASK, &sigs, NULL);
 	if (tsp)
-		*tsp = evTimeSpec(tv);
+		TIMEVAL_TO_TIMESPEC (tv, *tsp);
 	return (n);
 }
 #endif