commit
30cf391b89
5 changed files with 25 additions and 49 deletions
|
@ -30,6 +30,7 @@
|
|||
#ifdef _WIN32
|
||||
#include <rb_lib.h>
|
||||
#include "getaddrinfo.h"
|
||||
#include "stdinc.h"
|
||||
|
||||
static const char in_addrany[] = { 0, 0, 0, 0 };
|
||||
static const char in_loopback[] = { 127, 0, 0, 1 };
|
||||
|
@ -187,7 +188,8 @@ str_isnumber(const char *p)
|
|||
char *ep;
|
||||
|
||||
if (*p == '\0')
|
||||
return NO;
|
||||
return false;
|
||||
|
||||
ep = NULL;
|
||||
errno = 0;
|
||||
(void)strtoul(p, &ep, 10);
|
||||
|
|
|
@ -78,24 +78,24 @@ typedef struct
|
|||
*/
|
||||
#define IRC_NS_GET16(s, cp) { \
|
||||
const unsigned char *t_cp = (const unsigned char *)(cp); \
|
||||
(s) = ((u_int16_t)t_cp[0] << 8) \
|
||||
| ((u_int16_t)t_cp[1]) \
|
||||
(s) = ((uint16_t)t_cp[0] << 8) \
|
||||
| ((uint16_t)t_cp[1]) \
|
||||
; \
|
||||
(cp) += NS_INT16SZ; \
|
||||
}
|
||||
|
||||
#define IRC_NS_GET32(l, cp) { \
|
||||
const unsigned char *t_cp = (const unsigned char *)(cp); \
|
||||
(l) = ((u_int32_t)t_cp[0] << 24) \
|
||||
| ((u_int32_t)t_cp[1] << 16) \
|
||||
| ((u_int32_t)t_cp[2] << 8) \
|
||||
| ((u_int32_t)t_cp[3]) \
|
||||
(l) = ((uint32_t)t_cp[0] << 24) \
|
||||
| ((uint32_t)t_cp[1] << 16) \
|
||||
| ((uint32_t)t_cp[2] << 8) \
|
||||
| ((uint32_t)t_cp[3]) \
|
||||
; \
|
||||
(cp) += NS_INT32SZ; \
|
||||
}
|
||||
|
||||
#define IRC_NS_PUT16(s, cp) { \
|
||||
u_int16_t t_s = (u_int16_t)(s); \
|
||||
uint16_t t_s = (uint16_t)(s); \
|
||||
unsigned char *t_cp = (unsigned char *)(cp); \
|
||||
*t_cp++ = t_s >> 8; \
|
||||
*t_cp = t_s; \
|
||||
|
@ -103,7 +103,7 @@ typedef struct
|
|||
}
|
||||
|
||||
#define IRC_NS_PUT32(l, cp) { \
|
||||
u_int32_t t_l = (u_int32_t)(l); \
|
||||
uint32_t t_l = (uint32_t)(l); \
|
||||
unsigned char *t_cp = (unsigned char *)(cp); \
|
||||
*t_cp++ = t_l >> 24; \
|
||||
*t_cp++ = t_l >> 16; \
|
||||
|
|
30
configure.ac
30
configure.ac
|
@ -188,34 +188,8 @@ dnl Check for stdarg.h - if we can't find it, halt configure
|
|||
AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - charybdis will not compile without it **])])
|
||||
AC_CHECK_FUNCS([strlcat strlcpy])
|
||||
|
||||
AC_CHECK_TYPE([u_int32_t], [],
|
||||
[
|
||||
AC_CHECK_TYPE([uint32_t],
|
||||
[
|
||||
AC_DEFINE(u_int32_t, [uint32_t], [If system does not define u_int32_t, define a reasonable substitute.])
|
||||
],
|
||||
[
|
||||
AC_MSG_WARN([system has no u_int32_t or uint32_t, default to unsigned long int])
|
||||
AC_DEFINE(u_int32_t, [unsigned long int], [If system does not define u_int32_t, define to unsigned long int here.])
|
||||
])
|
||||
])
|
||||
|
||||
AC_CHECK_TYPE([u_int16_t], [],
|
||||
[
|
||||
AC_CHECK_TYPE([uint16_t],
|
||||
[
|
||||
AC_DEFINE(u_int16_t, [uint16_t], [If system does not define u_int16_t, define a usable substitute])
|
||||
],
|
||||
[
|
||||
AC_MSG_WARN([system has no u_int16_t or uint16_t, default to unsigned short int])
|
||||
AC_DEFINE(u_int16_t, [unsigned short int], [If system does not define u_int16_t, define a usable substitute.])
|
||||
])
|
||||
])
|
||||
|
||||
AC_CHECK_TYPE([in_port_t], [],
|
||||
[AC_DEFINE(in_port_t, [u_int16_t], [If system does not define in_port_t, define it to what it should be.])],
|
||||
[[#include <sys/types.h>
|
||||
#include <netinet/in.h>]])
|
||||
AC_TYPE_INT16_T
|
||||
AC_TYPE_INT32_T
|
||||
|
||||
AC_CHECK_TYPE([sa_family_t], [],
|
||||
[AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])],
|
||||
|
|
|
@ -65,10 +65,10 @@ struct ConfItem;
|
|||
struct cachefile;
|
||||
struct nd_entry;
|
||||
|
||||
extern u_int32_t fnv_hash_upper(const unsigned char *s, int bits);
|
||||
extern u_int32_t fnv_hash(const unsigned char *s, int bits);
|
||||
extern u_int32_t fnv_hash_len(const unsigned char *s, int bits, int len);
|
||||
extern u_int32_t fnv_hash_upper_len(const unsigned char *s, int bits, int len);
|
||||
extern uint32_t fnv_hash_upper(const unsigned char *s, int bits);
|
||||
extern uint32_t fnv_hash(const unsigned char *s, int bits);
|
||||
extern uint32_t fnv_hash_len(const unsigned char *s, int bits, int len);
|
||||
extern uint32_t fnv_hash_upper_len(const unsigned char *s, int bits, int len);
|
||||
|
||||
extern void init_hash(void);
|
||||
|
||||
|
|
16
ircd/hash.c
16
ircd/hash.c
|
@ -70,10 +70,10 @@ init_hash(void)
|
|||
hostname_tree = rb_radixtree_create("hostname", irccasecanon);
|
||||
}
|
||||
|
||||
u_int32_t
|
||||
uint32_t
|
||||
fnv_hash_upper(const unsigned char *s, int bits)
|
||||
{
|
||||
u_int32_t h = FNV1_32_INIT;
|
||||
uint32_t h = FNV1_32_INIT;
|
||||
|
||||
while (*s)
|
||||
{
|
||||
|
@ -85,10 +85,10 @@ fnv_hash_upper(const unsigned char *s, int bits)
|
|||
return h;
|
||||
}
|
||||
|
||||
u_int32_t
|
||||
uint32_t
|
||||
fnv_hash(const unsigned char *s, int bits)
|
||||
{
|
||||
u_int32_t h = FNV1_32_INIT;
|
||||
uint32_t h = FNV1_32_INIT;
|
||||
|
||||
while (*s)
|
||||
{
|
||||
|
@ -100,10 +100,10 @@ fnv_hash(const unsigned char *s, int bits)
|
|||
return h;
|
||||
}
|
||||
|
||||
u_int32_t
|
||||
uint32_t
|
||||
fnv_hash_len(const unsigned char *s, int bits, int len)
|
||||
{
|
||||
u_int32_t h = FNV1_32_INIT;
|
||||
uint32_t h = FNV1_32_INIT;
|
||||
const unsigned char *x = s + len;
|
||||
while (*s && s < x)
|
||||
{
|
||||
|
@ -115,10 +115,10 @@ fnv_hash_len(const unsigned char *s, int bits, int len)
|
|||
return h;
|
||||
}
|
||||
|
||||
u_int32_t
|
||||
uint32_t
|
||||
fnv_hash_upper_len(const unsigned char *s, int bits, int len)
|
||||
{
|
||||
u_int32_t h = FNV1_32_INIT;
|
||||
uint32_t h = FNV1_32_INIT;
|
||||
const unsigned char *x = s + len;
|
||||
while (*s && s < x)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue