Replace non-standard 'u_int32_t' with 'unsigned int'

Rather than standard uint32_t from stdint.h since it's C99.
Also adjust configure.ac to provide a uint64_t if one isn't available
for use in ctimer.c.
This commit is contained in:
Matthew Brush 2013-03-07 12:31:52 -08:00
parent 838479689d
commit 1294791f0c
3 changed files with 19 additions and 19 deletions

View File

@ -21,6 +21,7 @@ AC_CHECK_HEADERS([stdarg.h sys/time.h])
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_UINT64_T
# Checks for library functions.
AC_FUNC_MALLOC

View File

@ -101,7 +101,7 @@ struct cfuhash_table {
#ifdef HAVE_PTHREAD_H
pthread_mutex_t mutex;
#endif
u_int32_t flags;
unsigned int flags;
cfuhash_function_t hash_func;
size_t each_bucket_index;
cfuhash_entry *each_chain_entry;
@ -113,7 +113,7 @@ struct cfuhash_table {
};
/* Perl's hash function */
static u_int32_t
static unsigned int
hash_func(const void *key, size_t length) {
register size_t i = length;
register unsigned int hv = 0; /* could put a seed here instead of zero */
@ -177,7 +177,7 @@ hash_value(cfuhash_table_t *ht, const void *key, size_t key_size, size_t num_buc
}
static cfuhash_table_t *
_cfuhash_new(size_t size, u_int32_t flags) {
_cfuhash_new(size_t size, unsigned int flags) {
cfuhash_table_t *ht;
size = hash_size(size);
@ -213,7 +213,7 @@ cfuhash_new_with_initial_size(size_t size) {
}
cfuhash_table_t *
cfuhash_new_with_flags(u_int32_t flags) {
cfuhash_new_with_flags(unsigned int flags) {
return _cfuhash_new(8, CFUHASH_FROZEN_UNTIL_GROWS|flags);
}
@ -248,7 +248,7 @@ cfuhash_copy(cfuhash_table_t *src, cfuhash_table_t *dst) {
}
cfuhash_table_t *
cfuhash_merge(cfuhash_table_t *ht1, cfuhash_table_t *ht2, u_int32_t flags) {
cfuhash_merge(cfuhash_table_t *ht1, cfuhash_table_t *ht2, unsigned int flags) {
cfuhash_table_t *new_ht = NULL;
flags |= CFUHASH_FROZEN_UNTIL_GROWS;
@ -260,22 +260,22 @@ cfuhash_merge(cfuhash_table_t *ht1, cfuhash_table_t *ht2, u_int32_t flags) {
}
/* returns the flags */
u_int32_t
unsigned int
cfuhash_get_flags(cfuhash_table_t *ht) {
return ht->flags;
}
/* sets the given flag and returns the old flags value */
u_int32_t
cfuhash_set_flag(cfuhash_table_t *ht, u_int32_t new_flag) {
u_int32_t flags = ht->flags;
unsigned int
cfuhash_set_flag(cfuhash_table_t *ht, unsigned int new_flag) {
unsigned int flags = ht->flags;
ht->flags = flags | new_flag;
return flags;
}
u_int32_t
cfuhash_clear_flag(cfuhash_table_t *ht, u_int32_t new_flag) {
u_int32_t flags = ht->flags;
unsigned int
cfuhash_clear_flag(cfuhash_table_t *ht, unsigned int new_flag) {
unsigned int flags = ht->flags;
ht->flags = flags & ~new_flag;
return flags;
}

View File

@ -40,7 +40,6 @@
#include <cfu.h>
#include <stdio.h>
#include <sys/types.h>
CFU_BEGIN_DECLS
@ -48,7 +47,7 @@ CFU_BEGIN_DECLS
typedef struct cfuhash_table cfuhash_table_t;
/* Prototype for a pointer to a hashing function. */
typedef u_int32_t (*cfuhash_function_t)(const void *key, size_t length);
typedef unsigned int (*cfuhash_function_t)(const void *key, size_t length);
/* Prototype for a pointer to a free function. */
typedef void (*cfuhash_free_fn_t)(void *data);
@ -77,7 +76,7 @@ cfuhash_table_t * cfuhash_new_with_initial_size(size_t size);
/* Creates a new hash table with the specified flags. Pass zero
* for flags if you want the defaults.
*/
cfuhash_table_t * cfuhash_new_with_flags(u_int32_t flags);
cfuhash_table_t * cfuhash_new_with_flags(unsigned int flags);
/* Same as cfuhash_new() except automatically calls cfuhash_set_free_fn(). */
cfuhash_table_t * cfuhash_new_with_free_fn(cfuhash_free_fn_t ff);
@ -89,7 +88,7 @@ int cfuhash_copy(cfuhash_table_t *src, cfuhash_table_t *dst);
* For any entries with the same key, the one from ht2 wins.
*/
cfuhash_table_t * cfuhash_merge(cfuhash_table_t *ht1, cfuhash_table_t *ht2,
u_int32_t flags);
unsigned int flags);
/* Sets the hashing function to use when computing which bucket to add
* entries to. It should return a 32-bit unsigned integer. By
@ -112,13 +111,13 @@ int cfuhash_set_thresholds(cfuhash_table_t *ht, float low, float high);
int cfuhash_set_free_function(cfuhash_table_t * ht, cfuhash_free_fn_t ff);
/* Returns the hash's flags. See below for flag definitions. */
u_int32_t cfuhash_get_flags(cfuhash_table_t *ht);
unsigned int cfuhash_get_flags(cfuhash_table_t *ht);
/* Sets a flag. */
u_int32_t cfuhash_set_flag(cfuhash_table_t *ht, u_int32_t flag);
unsigned int cfuhash_set_flag(cfuhash_table_t *ht, unsigned int flag);
/* Clears a flag. */
u_int32_t cfuhash_clear_flag(cfuhash_table_t *ht, u_int32_t new_flag);
unsigned int cfuhash_clear_flag(cfuhash_table_t *ht, unsigned int new_flag);
/* Returns the value for the entry with given key. If key_size is -1,
* key is assumed to be a null-terminated string. If data_size is not