ser-tcp.c: Small signed->unsigned cleanup.

The "set tcp connect-timeout" variable is unsigned:

  /* Timeout period for connections, in seconds.  */

  static unsigned int tcp_retry_limit = 15;

And used like:

  /* Check for timeout.  */
  if (*polls > tcp_retry_limit * POLL_INTERVAL)
    {
      errno = ETIMEDOUT;
      return -1;
    }

Which made me stop and look over why is it that 'polls' is signed.
What I found is there's really no reason.

gdb/
2013-03-26  Pedro Alves  <palves@redhat.com>

	* ser-tcp.c (wait_for_connect): Make 'polls' parameter unsigned.
	(net_open): Make 'polls' local unsigned.
This commit is contained in:
Pedro Alves 2013-03-26 20:29:47 +00:00
parent 1b49319248
commit 2c619be216
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2013-03-26 Pedro Alves <palves@redhat.com>
* ser-tcp.c (wait_for_connect): Make 'polls' parameter unsigned.
(net_open): Make 'polls' local unsigned.
2013-03-26 Pedro Alves <palves@redhat.com>
* remote.c (_initialize_remote): Make "set remoteaddresssize"

View File

@ -83,7 +83,7 @@ static unsigned int tcp_retry_limit = 15;
Returns -1 on timeout or interrupt, otherwise the value of select. */
static int
wait_for_connect (struct serial *scb, int *polls)
wait_for_connect (struct serial *scb, unsigned int *polls)
{
struct timeval t;
int n;
@ -165,7 +165,7 @@ net_open (struct serial *scb, const char *name)
#else
int ioarg;
#endif
int polls = 0;
unsigned int polls = 0;
use_udp = 0;
if (strncmp (name, "udp:", 4) == 0)