From 2e45f5d8086a3a0700e7926ea3f802ce8e13616d Mon Sep 17 00:00:00 2001 From: Matt Ullman Date: Wed, 23 Mar 2016 22:33:54 -0400 Subject: [PATCH] Cleanup more BSD-isms --- authd/reslib.h | 16 ++++++++-------- configure.ac | 30 ++---------------------------- include/hash.h | 8 ++++---- ircd/hash.c | 16 ++++++++-------- 4 files changed, 22 insertions(+), 48 deletions(-) diff --git a/authd/reslib.h b/authd/reslib.h index 38f7b8f3..e8917130 100644 --- a/authd/reslib.h +++ b/authd/reslib.h @@ -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; \ diff --git a/configure.ac b/configure.ac index 333a793d..2911f973 100644 --- a/configure.ac +++ b/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 -#include ]]) +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.])], diff --git a/include/hash.h b/include/hash.h index 4aba22cc..c2d220db 100644 --- a/include/hash.h +++ b/include/hash.h @@ -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); diff --git a/ircd/hash.c b/ircd/hash.c index c1ef81cb..172734d3 100644 --- a/ircd/hash.c +++ b/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) {