about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-02-02 15:53:48 +0000
committerUlrich Drepper <drepper@redhat.com>2007-02-02 15:53:48 +0000
commitf2ccf9839e30822af8a5aa3c45a6427bca7016f4 (patch)
tree85bdf0f61d29c5748ebfee817ecc642b98478761
parent73f50d5a6923e404a24c398f4a2cf494e0a37795 (diff)
downloadglibc-f2ccf9839e30822af8a5aa3c45a6427bca7016f4.tar.gz
glibc-f2ccf9839e30822af8a5aa3c45a6427bca7016f4.tar.xz
glibc-f2ccf9839e30822af8a5aa3c45a6427bca7016f4.zip
* nscd/nscd_helper.c (open_socket): Minor size optimization.
-rw-r--r--ChangeLog6
-rw-r--r--nscd/nscd_helper.c16
2 files changed, 12 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 914874c514..1650cb71bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,12 @@
+2007-02-02  Ulrich Drepper  <drepper@redhat.com>
+
+	* nscd/nscd_helper.c (open_socket): Minor size optimization.
+
 2007-02-02  Jakub Jelinek  <jakub@redhat.com>
 
 	* include/locale.h (__uselocale): Add libc_hidden_proto.
 	* locale/uselocale.c (__uselocale): Add libc_hidden_def.
 
-2007-02-02  Jakub Jelinek  <jakub@redhat.com>
-
 	* nscd/nscd_helper.c (open_socket): Use __gettimeofday instead of
 	gettimeofday.
 
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
index b94bc02077..577c6a052a 100644
--- a/nscd/nscd_helper.c
+++ b/nscd/nscd_helper.c
@@ -127,6 +127,8 @@ open_socket (request_type type, const char *key, size_t keylen)
 
   bool first_try = true;
   struct timeval tvend;
+  /* Fake initializing tvend.  */
+  asm ("" : "=m" (tvend));
   while (1)
     {
 #ifndef MSG_NOSIGNAL
@@ -145,20 +147,18 @@ open_socket (request_type type, const char *key, size_t keylen)
 
       /* The daemon is busy wait for it.  */
       int to;
+      struct timeval now;
+      (void) __gettimeofday (&now, NULL);
       if (first_try)
 	{
-	  (void) __gettimeofday (&tvend, NULL);
-	  tvend.tv_sec += 5;
+	  tvend.tv_usec = now.tv_usec;
+	  tvend.tv_sec = now.tv_sec + 5;
 	  to = 5 * 1000;
 	  first_try = false;
 	}
       else
-	{
-	  struct timeval now;
-	  (void) __gettimeofday (&now, NULL);
-	  to = ((tvend.tv_sec - now.tv_sec) * 1000
-		+ (tvend.tv_usec - now.tv_usec) / 1000);
-	}
+	to = ((tvend.tv_sec - now.tv_sec) * 1000
+	      + (tvend.tv_usec - now.tv_usec) / 1000);
 
       struct pollfd fds[1];
       fds[0].fd = sock;