Browse Source

* 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.
tags/v0.99.beta14
Sam Hocevar sam 16 years ago
parent
commit
99d7e53aee
3 changed files with 8 additions and 21 deletions
  1. +1
    -14
      kernel/kernel.c
  2. +5
    -5
      stubs.h
  3. +2
    -2
      tools/makefont.c

+ 1
- 14
kernel/kernel.c View File

@@ -382,20 +382,7 @@ double sqrt(double x)
}

/* 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__ */

+ 5
- 5
stubs.h View File

@@ -50,10 +50,8 @@ static inline void debug(const char *format, ...)
#endif

/* 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>
# elif defined HAVE_NETINET_IN_H
# include <netinet/in.h>
@@ -61,7 +59,9 @@ static inline void debug(const char *format, ...)
# define hton16 htons
# define hton32 htonl
#else
# if defined HAVE_ENDIAN_H
# if defined __KERNEL__
/* Nothing to do */
# elif defined HAVE_ENDIAN_H
# include <endian.h>
# endif
static inline uint16_t hton16(uint16_t x)


+ 2
- 2
tools/makefont.c View File

@@ -436,13 +436,13 @@ static int printf_unicode(struct glyph *g)

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);
}

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);
}



Loading…
Cancel
Save