Wireshark-dev: Re: [Wireshark-dev] Merging wiretap pint macro to wsutil/pint.h

From: Jakub Zawadzki <darkjames-ws@xxxxxxxxxxxx>
Date: Thu, 28 Nov 2013 23:47:04 +0100
On Thu, Nov 28, 2013 at 01:40:31PM -0800, Guy Harris wrote:
> 
> On Nov 28, 2013, at 1:39 PM, Jakub Zawadzki <darkjames-ws@xxxxxxxxxxxx> wrote:
> 
> > On Tue, Nov 19, 2013 at 07:15:54PM +0100, Jakub Zawadzki wrote:
> >> htons(), htonl(), htonll() is kinda easier to write and looks prettier for me than hton16, hton32, hton64().
> > 
> > It seems that such change would get us to have name conflict with <endian.h> (at least on Linux),
> 
> phtoXX() take a pointer and handles unaligned data; renaming them won't cause a conflict with the Linux #defines.
> 
> htoXX() take an argument and just byte-swaps as necessary; they're currently just wrappers for GLib macros:
> 
> 	/* Turn host-byte-order values into little-endian values. */  
> 	#define htoles(s) GUINT16_TO_LE(s)
> 	#define htolel(l) GUINT32_TO_LE(l)
> 
> so one option would simply be to get rid of htoles() and htolel() and just use the GLib macros directly.

If we want to go this way (use glib macros directly), we can also kill BSWAP16, BSWAP32, BSWAP64 macros, and replace with: 
   GUINT16_SWAP_LE_BE, GUINT32_SWAP_LE_BE, GUINT64_SWAP_LE_BE

Ok?