From 5f65f6be53b3e3d92969b1dd414e0c6473bdf1ec Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Thu, 1 Apr 2010 11:06:13 -0700 Subject: [PATCH] Remove bitfield hack (solaris blows anyways). --- libhashkit/configure.h.in | 2 -- libhashkit/hashkit.h | 4 +-- libmemcached/configure.h.in | 1 - libmemcached/memcached.h | 40 ++++++++++++++--------------- libmemcached/result.h | 4 +-- libmemcached/server.h | 8 +++--- libmemcached/string.h | 4 +-- m4/bitfield.m4 | 51 ------------------------------------- 8 files changed, 30 insertions(+), 84 deletions(-) delete mode 100644 m4/bitfield.m4 diff --git a/libhashkit/configure.h.in b/libhashkit/configure.h.in index 6fa78177..29d05aea 100644 --- a/libhashkit/configure.h.in +++ b/libhashkit/configure.h.in @@ -12,8 +12,6 @@ extern "C" { #endif -@HASHKIT_BITFIELD@ - #ifdef __cplusplus } #endif diff --git a/libhashkit/hashkit.h b/libhashkit/hashkit.h index e3d5862e..45133307 100644 --- a/libhashkit/hashkit.h +++ b/libhashkit/hashkit.h @@ -58,11 +58,11 @@ struct hashkit_st } base_hash, distribution_hash; struct { - bool is_base_same_distributed HASHKIT_BITFIELD; + bool is_base_same_distributed:1; } flags; struct { - bool is_allocated HASHKIT_BITFIELD; + bool is_allocated:1; } options; }; diff --git a/libmemcached/configure.h.in b/libmemcached/configure.h.in index c030d305..c45cc803 100644 --- a/libmemcached/configure.h.in +++ b/libmemcached/configure.h.in @@ -16,7 +16,6 @@ extern "C" { #endif -@MEMCACHED_BITFIELD@ @DEPRECATED@ @LIBMEMCACHED_WITH_SASL_SUPPORT@ diff --git a/libmemcached/memcached.h b/libmemcached/memcached.h index 5aca6db1..81120c54 100644 --- a/libmemcached/memcached.h +++ b/libmemcached/memcached.h @@ -60,27 +60,27 @@ struct memcached_st { @note these are static and should not change without a call to behavior. */ struct { - bool is_purging MEMCACHED_BITFIELD; - bool is_processing_input MEMCACHED_BITFIELD; + bool is_purging:1; + bool is_processing_input:1; } state; struct { // Everything below here is pretty static. - bool auto_eject_hosts MEMCACHED_BITFIELD; - bool binary_protocol MEMCACHED_BITFIELD; - bool buffer_requests MEMCACHED_BITFIELD; - bool cork MEMCACHED_BITFIELD; - bool hash_with_prefix_key MEMCACHED_BITFIELD; - bool ketama_weighted MEMCACHED_BITFIELD; - bool no_block MEMCACHED_BITFIELD; - bool no_reply MEMCACHED_BITFIELD; - bool randomize_replica_read MEMCACHED_BITFIELD; - bool reuse_memory MEMCACHED_BITFIELD; - bool support_cas MEMCACHED_BITFIELD; - bool tcp_nodelay MEMCACHED_BITFIELD; - bool use_cache_lookups MEMCACHED_BITFIELD; - bool use_sort_hosts MEMCACHED_BITFIELD; - bool use_udp MEMCACHED_BITFIELD; - bool verify_key MEMCACHED_BITFIELD; + bool auto_eject_hosts:1; + bool binary_protocol:1; + bool buffer_requests:1; + bool cork:1; + bool hash_with_prefix_key:1; + bool ketama_weighted:1; + bool no_block:1; + bool no_reply:1; + bool randomize_replica_read:1; + bool reuse_memory:1; + bool support_cas:1; + bool tcp_nodelay:1; + bool use_cache_lookups:1; + bool use_sort_hosts:1; + bool use_udp:1; + bool verify_key:1; } flags; memcached_server_distribution_t distribution; hashkit_st hashkit; @@ -129,13 +129,13 @@ struct memcached_st { ** Did we allocate data inside the callbacks, or did the user ** supply that. */ - bool is_allocated MEMCACHED_BITFIELD; + bool is_allocated:1; } sasl; #endif char prefix_key[MEMCACHED_PREFIX_KEY_MAX_SIZE]; struct { - bool is_allocated MEMCACHED_BITFIELD; + bool is_allocated:1; } options; }; diff --git a/libmemcached/result.h b/libmemcached/result.h index 59ce9b91..46ea6eff 100644 --- a/libmemcached/result.h +++ b/libmemcached/result.h @@ -21,8 +21,8 @@ struct memcached_result_st { memcached_string_st value; char item_key[MEMCACHED_MAX_KEY]; struct { - bool is_allocated MEMCACHED_BITFIELD; - bool is_initialized MEMCACHED_BITFIELD; + bool is_allocated:1; + bool is_initialized:1; } options; /* Add result callback function */ }; diff --git a/libmemcached/server.h b/libmemcached/server.h index 44a32bba..92e6d888 100644 --- a/libmemcached/server.h +++ b/libmemcached/server.h @@ -15,10 +15,10 @@ struct memcached_server_st { struct { - bool is_allocated MEMCACHED_BITFIELD; - bool is_initialized MEMCACHED_BITFIELD; - bool sockaddr_inited MEMCACHED_BITFIELD; - bool is_shutting_down MEMCACHED_BITFIELD; + bool is_allocated:1; + bool is_initialized:1; + bool sockaddr_inited:1; + bool is_shutting_down:1; } options; uint32_t number_of_hosts; uint32_t cursor_active; diff --git a/libmemcached/string.h b/libmemcached/string.h index ef567874..ca2c1220 100644 --- a/libmemcached/string.h +++ b/libmemcached/string.h @@ -28,8 +28,8 @@ struct memcached_string_st { size_t current_size; const memcached_st *root; struct { - bool is_allocated MEMCACHED_BITFIELD; - bool is_initialized MEMCACHED_BITFIELD; + bool is_allocated:1; + bool is_initialized:1; } options; }; diff --git a/m4/bitfield.m4 b/m4/bitfield.m4 deleted file mode 100644 index 594855c2..00000000 --- a/m4/bitfield.m4 +++ /dev/null @@ -1,51 +0,0 @@ -AC_DEFUN([DETECT_BITFIELD], -[ - AC_CACHE_CHECK([for working bitfield],[ac_cv_have_bitfield],[ - AC_LANG_PUSH([C]) - save_CFLAGS="${CFLAGS}" - CFLAGS="${AM_CFLAGS} ${NO_WERROR}" - - AC_RUN_IFELSE([ - AC_LANG_PROGRAM([[ -#include - ]],[[ - struct flags { bool b0:1; bool b1:1; bool b2:1; bool b3:1; - bool b4:1; bool b5:1; bool b6:1; bool b7:1; - } f = { .b0 = false, .b1 = false, .b2 = false, .b3 = false, - .b4 = false, .b5 = false, .b6 = false, .b7 = false }; - - f.b0 = true; - f.b1 = false; - f.b2 = true; - f.b3 = false; - f.b4 = true; - f.b5 = false; - f.b6 = true; - f.b7 = false; - - if (f.b0 && !f.b1 && f.b2 && !f.b3 && f.b4 && !f.b5 && f.b6 && !f.b7) { - return 0; - } - - return 1; - ]]) - ], [ - ac_cv_have_bitfield=yes - ],[ - ac_cv_have_bitfield=no - ])]) - - CFLAGS=${save_CFLAGS} - AS_IF([test "x$ac_cv_have_bitfield" = "xyes"], - [ - MEMCACHED_BITFIELD="#define MEMCACHED_BITFIELD :1" - HASHKIT_BITFIELD="#define HASHKIT_BITFIELD :1" - ], - [ - MEMCACHED_BITFIELD="#define MEMCACHED_BITFIELD" - HASHKIT_BITFIELD="#define HASHKIT_BITFIELD" - ]) - AC_SUBST([MEMCACHED_BITFIELD]) - AC_SUBST([HASHKIT_BITFIELD]) - AC_LANG_POP() -]) -- 2.30.2