Skip to content

Commit

Permalink
* nscd/nscd_helper.c (open_socket): Minor size optimization.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Feb 2, 2007
1 parent 73f50d5 commit f2ccf98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
6 changes: 4 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
16 changes: 8 additions & 8 deletions nscd/nscd_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down

0 comments on commit f2ccf98

Please sign in to comment.