[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getaddrinfo.c: don't require snprintf; new function: shorttostr
From: |
Simon Josefsson |
Subject: |
Re: getaddrinfo.c: don't require snprintf; new function: shorttostr |
Date: |
Sat, 21 Oct 2006 11:32:05 +0200 |
On Sat, 2006-10-21 at 10:39 +0200, Jim Meyering wrote:
> Paul, Simon,
> Any objection to the changes below?
Seems generally fine to me, thanks!
> + short int port = ntohs (((const struct sockaddr_in *) sa)->sin_port);
Shouldn't 'short int' be either 'unsigned short int' or 'uint16_t'?
My ntohs man page says it returns uint16_t, although sin_port is
'unsigned short int' on my Linux system (perhaps Linux uses different
sin_port types depending on platforms, to make sure it is always 16
bits?).
In any case, it should probably be unsigned.
I'm leaning towards uint16_t, because abstract port numbers is a 16-bit
integer.
/Simon