Changeset 2398


Ignore:
Timestamp:
Jun 15, 2008, 2:28:14 PM (12 years ago)
Author:
Sam Hocevar
Message:
  • Remove htons() and htonl() from kernel mode: we use our custom hton16() and hton32() implementations everywhere instead, except in cacaserver which requires <arpa/inet.h> stuff anyway.
Location:
libcaca/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/kernel/kernel.c

    r2300 r2398  
    383383
    384384/* errno.h stuff */
     385
    385386int errno = 0;
    386387
    387 /* arpa/inet.h functions */
    388 
    389 /* XXX FIXME Converts only from little endian to big endian (x86) */
    390 unsigned int htonl(unsigned int hostlong)
    391 {
    392     return ((hostlong&0xFFFF0000)>>16)|((hostlong&0x0000FFFFFF)<<16);
    393 }
    394 
    395 /* XXX FIXME Converts only from little endian to big endian (x86) */
    396 unsigned short htons(unsigned short hostlong)
    397 {
    398     return ((hostlong&0xFF00)>>8)|((hostlong&0x00FF)<<8);
    399 }
    400 
    401388#endif /* __KERNEL__ */
  • libcaca/trunk/stubs.h

    r2299 r2398  
    5151
    5252/* hton16() and hton32() */
    53 #if defined HAVE_HTONS
    54 #   if defined __KERNEL__
    55         /* Nothing to do */
    56 #   elif defined HAVE_ARPA_INET_H
     53#if defined HAVE_HTONS && !defined __KERNEL__
     54#   if defined HAVE_ARPA_INET_H
    5755#       include <arpa/inet.h>
    5856#   elif defined HAVE_NETINET_IN_H
     
    6260#   define hton32 htonl
    6361#else
    64 #   if defined HAVE_ENDIAN_H
     62#   if defined __KERNEL__
     63        /* Nothing to do */
     64#   elif defined HAVE_ENDIAN_H
    6565#       include <endian.h>
    6666#   endif
  • libcaca/trunk/tools/makefont.c

    r2299 r2398  
    437437static int printf_u32(char const *fmt, uint32_t i)
    438438{
    439     uint32_t ni = htonl(i);
     439    uint32_t ni = hton32(i);
    440440    return printf_hex(fmt, (uint8_t *)&ni, 4);
    441441}
     
    443443static int printf_u16(char const *fmt, uint16_t i)
    444444{
    445     uint16_t ni = htons(i);
     445    uint16_t ni = hton16(i);
    446446    return printf_hex(fmt, (uint8_t *)&ni, 2);
    447447}
Note: See TracChangeset for help on using the changeset viewer.