[Libguestfs] [PATCH] daemon/Win32: provide htonl, htons, ntohl, ntohs functions.

Jim Meyering jim at meyering.net
Thu Nov 26 14:04:42 UTC 2009


Richard W.M. Jones wrote:
> On Thu, Nov 26, 2009 at 12:41:42PM +0100, Jim Meyering wrote:
>> Richard W.M. Jones wrote:
>> > This is another candidate for gnulib ...
>>
>> Yes, indeed.
>>
>> ...
>> > +static inline uint16_t
>> > +htons (x)
>> > +     uint16_t x;
>> > +{
>>
>> Using old-style function definitions like this is odd,
>> but then I realized this was probably copied from glibc.
>
> Yes, these are copied from glibc, but ...
>
>> Did you have to make any changes?
>
> This patch was a bit of a dog's dinner.  The functions also shouldn't
> be static(!)

Of course ;-)

...
> +uint32_t
> +htonl (x)
> +     uint32_t x;
...
> +uint32_t ntohl (uint32_t x) { return htonl (x); }

Looks ok.  ACK
Unless you're trying to minimize diffs with glibc,
you may want to make all four definitions be ANSI.
...
> +uint16_t
> +htons (x)
> +     uint16_t x;
...
> +uint16_t ntohs (uint16_t x) { return htons (x); }




More information about the Libguestfs mailing list