and hton32() implementations everywhere instead, except in cacaserver
which requires <arpa/inet.h> stuff anyway.
tags/v0.99.beta14
| @@ -382,20 +382,7 @@ double sqrt(double x) | |||||
| } | } | ||||
| /* errno.h stuff */ | /* errno.h stuff */ | ||||
| int errno = 0; | |||||
| /* arpa/inet.h functions */ | |||||
| /* XXX FIXME Converts only from little endian to big endian (x86) */ | |||||
| unsigned int htonl(unsigned int hostlong) | |||||
| { | |||||
| return ((hostlong&0xFFFF0000)>>16)|((hostlong&0x0000FFFFFF)<<16); | |||||
| } | |||||
| /* XXX FIXME Converts only from little endian to big endian (x86) */ | |||||
| unsigned short htons(unsigned short hostlong) | |||||
| { | |||||
| return ((hostlong&0xFF00)>>8)|((hostlong&0x00FF)<<8); | |||||
| } | |||||
| int errno = 0; | |||||
| #endif /* __KERNEL__ */ | #endif /* __KERNEL__ */ | ||||
| @@ -50,10 +50,8 @@ static inline void debug(const char *format, ...) | |||||
| #endif | #endif | ||||
| /* hton16() and hton32() */ | /* hton16() and hton32() */ | ||||
| #if defined HAVE_HTONS | |||||
| # if defined __KERNEL__ | |||||
| /* Nothing to do */ | |||||
| # elif defined HAVE_ARPA_INET_H | |||||
| #if defined HAVE_HTONS && !defined __KERNEL__ | |||||
| # if defined HAVE_ARPA_INET_H | |||||
| # include <arpa/inet.h> | # include <arpa/inet.h> | ||||
| # elif defined HAVE_NETINET_IN_H | # elif defined HAVE_NETINET_IN_H | ||||
| # include <netinet/in.h> | # include <netinet/in.h> | ||||
| @@ -61,7 +59,9 @@ static inline void debug(const char *format, ...) | |||||
| # define hton16 htons | # define hton16 htons | ||||
| # define hton32 htonl | # define hton32 htonl | ||||
| #else | #else | ||||
| # if defined HAVE_ENDIAN_H | |||||
| # if defined __KERNEL__ | |||||
| /* Nothing to do */ | |||||
| # elif defined HAVE_ENDIAN_H | |||||
| # include <endian.h> | # include <endian.h> | ||||
| # endif | # endif | ||||
| static inline uint16_t hton16(uint16_t x) | static inline uint16_t hton16(uint16_t x) | ||||
| @@ -436,13 +436,13 @@ static int printf_unicode(struct glyph *g) | |||||
| static int printf_u32(char const *fmt, uint32_t i) | static int printf_u32(char const *fmt, uint32_t i) | ||||
| { | { | ||||
| uint32_t ni = htonl(i); | |||||
| uint32_t ni = hton32(i); | |||||
| return printf_hex(fmt, (uint8_t *)&ni, 4); | return printf_hex(fmt, (uint8_t *)&ni, 4); | ||||
| } | } | ||||
| static int printf_u16(char const *fmt, uint16_t i) | static int printf_u16(char const *fmt, uint16_t i) | ||||
| { | { | ||||
| uint16_t ni = htons(i); | |||||
| uint16_t ni = hton16(i); | |||||
| return printf_hex(fmt, (uint8_t *)&ni, 2); | return printf_hex(fmt, (uint8_t *)&ni, 2); | ||||
| } | } | ||||