More const correctness.
authorBrian Aker <brian@gir.tangent.org>
Thu, 17 Dec 2009 00:11:59 +0000 (16:11 -0800)
committerBrian Aker <brian@gir.tangent.org>
Thu, 17 Dec 2009 00:11:59 +0000 (16:11 -0800)
16 files changed:
Makefile.am
libmemcached/behavior.c
libmemcached/behavior.h
libmemcached/callback.c
libmemcached/callback.h
libmemcached/common.h
libmemcached/get.h
libmemcached/io.h
libmemcached/memcached_util.h
libmemcached/pool.h
libmemcached/protocol_handler.h
libmemcached/result.h
libmemcached/server.c
libmemcached/server.h
libmemcached/storage.h
libmemcached/types.h

index 7aa35f03531ab01fabfec37370181d4dc745b859..e687f9ceed3a6e36ee56b8bf4c68b06cc7e0ec9a 100644 (file)
@@ -35,10 +35,11 @@ generic:
 
 rpm: all dist generic fedora
 
-clean-merge:
-       find ./ | grep \.orig | xargs rm
-       find ./ | grep \.rej | xargs rm
-       find ./ | grep \~$ | xargs rm
+merge-clean:
+       find ./ | $(GREP) \.orig | xargs rm -f
+       find ./ | $(GREP) \.rej | xargs rm -f
+       find ./ | $(GREP) \~$$ | xargs rm -f
+       bzr unknowns
 
 hudson-valgrind: all
        @(cd tests; ${MAKE} hudson-valgrind)
index 37c9f5299db70e05e9ecd1bbb0af164f44d91f69..e020258d1229fc7561f21bf76d7ab2fd7781fd99 100644 (file)
@@ -22,7 +22,7 @@
 */
 
 memcached_return_t memcached_behavior_set(memcached_st *ptr,
-                                          memcached_behavior_t flag,
+                                          const memcached_behavior_t flag,
                                           uint64_t data)
 {
   switch (flag)
@@ -196,7 +196,7 @@ memcached_return_t memcached_behavior_set(memcached_st *ptr,
 }
 
 uint64_t memcached_behavior_get(memcached_st *ptr,
-                                memcached_behavior_t flag)
+                                const memcached_behavior_t flag)
 {
   switch (flag)
   {
index 14cbc3aad3d342d60af4d12d66bb62b66ac462ac..5abc0331df9d8cd67d342855821a5afe54240fd8 100644 (file)
@@ -17,10 +17,10 @@ extern "C" {
 #endif
 
 LIBMEMCACHED_API
-memcached_return_t memcached_behavior_set(memcached_st *ptr, memcached_behavior_t flag, uint64_t data);
+memcached_return_t memcached_behavior_set(memcached_st *ptr, const memcached_behavior_t flag, uint64_t data);
 
 LIBMEMCACHED_API
-uint64_t memcached_behavior_get(memcached_st *ptr, memcached_behavior_t flag);
+uint64_t memcached_behavior_get(memcached_st *ptr, const memcached_behavior_t flag);
 
 
 #ifdef __cplusplus
index b0ddfc2ba0d394c311ba9c39f39c1703cc6a2d97..aadde22caad7fab48db5b568f01395e2fcd99520 100644 (file)
@@ -19,7 +19,7 @@
 */
 
 memcached_return_t memcached_callback_set(memcached_st *ptr, 
-                                          memcached_callback_t flag, 
+                                          const memcached_callback_t flag, 
                                           void *data)
 {
   switch (flag)
@@ -113,7 +113,7 @@ memcached_return_t memcached_callback_set(memcached_st *ptr,
 }
 
 void *memcached_callback_get(memcached_st *ptr, 
-                             memcached_callback_t flag,
+                             const memcached_callback_t flag,
                              memcached_return_t *error)
 {
   memcached_return_t local_error;
index 0719a66fb301abd8b9053864904d952e8e482793..de64a1996eb1a72152eac30af7c1c863145ab198 100644 (file)
@@ -18,11 +18,11 @@ extern "C" {
 
 LIBMEMCACHED_API
 memcached_return_t memcached_callback_set(memcached_st *ptr,
-                                          memcached_callback_t flag,
+                                          const memcached_callback_t flag,
                                           void *data);
 LIBMEMCACHED_API
 void *memcached_callback_get(memcached_st *ptr,
-                             memcached_callback_t flag,
+                             const memcached_callback_t flag,
                              memcached_return_t *error);
 
 #ifdef __cplusplus
index c9d7cf812add5678282bd13d3de8065aa4cb5aef..97899ea95eb9e6b35d2b77eb7b7f877be419d92c 100644 (file)
@@ -62,7 +62,8 @@
 #include "libmemcached/byteorder.h"
 
 /* string value */
-struct memcached_continuum_item_st {
+struct memcached_continuum_item_st
+{
   uint32_t index;
   uint32_t value;
 };
index bb04a15432f24ee2b4aead8e6d941a8be1506668..2e5b2f991a7c6dc84c978980a82fbc9c8ca154dd 100644 (file)
@@ -1,5 +1,5 @@
 /* LibMemcached
- * Copyright (C) 2006-2009 Brian Aker 
+ * Copyright (C) 2006-2009 Brian Aker
  * All rights reserved.
  *
  * Use and distribution licensed under the BSD license.  See
@@ -18,42 +18,44 @@ extern "C" {
 
 /* Public defines */
 LIBMEMCACHED_API
-char *memcached_get(memcached_st *ptr, 
+char *memcached_get(memcached_st *ptr,
                     const char *key, size_t key_length,
-                    size_t *value_length, 
+                    size_t *value_length,
                     uint32_t *flags,
                     memcached_return_t *error);
 
 LIBMEMCACHED_API
-memcached_return_t memcached_mget(memcached_st *ptr, 
-                                  const char * const *keys, 
-                                  const size_t *key_length, 
+memcached_return_t memcached_mget(memcached_st *ptr,
+                                  const char * const *keys,
+                                  const size_t *key_length,
                                   size_t number_of_keys);
 
 LIBMEMCACHED_API
-char *memcached_get_by_key(memcached_st *ptr, 
-                           const char *master_key, size_t master_key_length, 
-                           const char *key, size_t key_length, 
-                           size_t *value_length, 
+char *memcached_get_by_key(memcached_st *ptr,
+                           const char *master_key, size_t master_key_length,
+                           const char *key, size_t key_length,
+                           size_t *value_length,
                            uint32_t *flags,
                            memcached_return_t *error);
 
 LIBMEMCACHED_API
-memcached_return_t memcached_mget_by_key(memcached_st *ptr, 
-                                         const char *master_key, size_t 
-                                         master_key_length,
-                                         const char * const *keys, 
-                                         const size_t *key_length, 
-                                         size_t number_of_keys);
+memcached_return_t memcached_mget_by_key(memcached_st *ptr,
+                                         const char *master_key,
+                                         size_t master_key_length,
+                                         const char * const *keys,
+                                         const size_t *key_length,
+                                         const size_t number_of_keys);
 
 LIBMEMCACHED_API
-char *memcached_fetch(memcached_st *ptr, 
-                      char *key, size_t *key_length, 
-                      size_t *value_length, uint32_t *flags, 
+char *memcached_fetch(memcached_st *ptr,
+                      char *key,
+                      size_t *key_length,
+                      size_t *value_length,
+                      uint32_t *flags,
                       memcached_return_t *error);
 
 LIBMEMCACHED_API
-memcached_result_st *memcached_fetch_result(memcached_st *ptr, 
+memcached_result_st *memcached_fetch_result(memcached_st *ptr,
                                             memcached_result_st *result,
                                             memcached_return_t *error);
 
@@ -61,10 +63,10 @@ LIBMEMCACHED_API
 memcached_return_t memcached_mget_execute(memcached_st *ptr,
                                           const char * const *keys,
                                           const size_t *key_length,
-                                          size_t number_of_keys,
+                                          const size_t number_of_keys,
                                           memcached_execute_fn *callback,
                                           void *context,
-                                          unsigned int number_of_callbacks);
+                                          const uint32_t number_of_callbacks);
 
 LIBMEMCACHED_API
 memcached_return_t memcached_mget_execute_by_key(memcached_st *ptr,
@@ -75,7 +77,7 @@ memcached_return_t memcached_mget_execute_by_key(memcached_st *ptr,
                                                  size_t number_of_keys,
                                                  memcached_execute_fn *callback,
                                                  void *context,
-                                                 unsigned int number_of_callbacks);
+                                                 const uint32_t number_of_callbacks);
 
 #ifdef __cplusplus
 }
index 03d63b5585b0ecfc708612dcf5367a1325ba9792..2929aacec6e748cb2bc8061f6b894ea579bbdbb1 100644 (file)
@@ -32,7 +32,8 @@ extern "C" {
 #define generate_udp_request_thread_id(A) (A) << UDP_REQUEST_ID_MSG_SIG_DIGITS
 #define UDP_REQUEST_ID_MAX_THREAD_ID get_thread_id_from_request_id(0xFFFF)
 
-struct udp_datagram_header_st {
+struct udp_datagram_header_st
+{
   uint16_t request_id;
   uint16_t sequence_number;
   uint16_t num_datagrams;
@@ -50,8 +51,8 @@ memcached_return_t memcached_io_readline(memcached_server_st *ptr,
                                          size_t size);
 memcached_return_t memcached_io_close(memcached_server_st *ptr);
 /* Read n bytes of data from the server and store them in dta */
-memcached_return_t memcached_safe_read(memcached_server_st *ptr, 
-                                       void *dta, 
+memcached_return_t memcached_safe_read(memcached_server_st *ptr,
+                                       void *dta,
                                        size_t size);
 /* Read a single response from the server */
 memcached_return_t memcached_read_one_response(memcached_server_st *ptr,
index c1a719d660eb50ffe1d5846c32c4f0f0b4162821..7b7c5e83ff9f40541f218f3fefb58ba6718486ad 100644 (file)
@@ -1,5 +1,5 @@
 /* LibMemcached
- * Copyright (C) 2006-2009 Brian Aker 
+ * Copyright (C) 2006-2009 Brian Aker
  * All rights reserved.
  *
  * Use and distribution licensed under the BSD license.  See
index 84dab3dd1732cff384df3e9aedecfb454e47f82a..b6325f3e6b968f948608bf5adce81fb50b075e61 100644 (file)
@@ -1,5 +1,5 @@
 /* LibMemcached
- * Copyright (C) 2006-2009 Brian Aker 
+ * Copyright (C) 2006-2009 Brian Aker
  * All rights reserved.
  *
  * Use and distribution licensed under the BSD license.  See
@@ -23,7 +23,7 @@ struct memcached_pool_st;
 typedef struct memcached_pool_st memcached_pool_st;
 
 LIBMEMCACHED_API
-memcached_pool_st *memcached_pool_create(memcached_st* mmc, uint32_t initial, 
+memcached_pool_st *memcached_pool_create(memcached_st* mmc, uint32_t initial,
                                          uint32_t max);
 LIBMEMCACHED_API
 memcached_st* memcached_pool_destroy(memcached_pool_st* pool);
@@ -32,8 +32,8 @@ memcached_st* memcached_pool_pop(memcached_pool_st* pool,
                                  bool block,
                                  memcached_return_t* rc);
 LIBMEMCACHED_API
-memcached_return_t memcached_pool_push(memcached_pool_st* pool, 
-                                     memcached_st* mmc);
+memcached_return_t memcached_pool_push(memcached_pool_st* pool,
+                                       memcached_st* mmc);
 
 LIBMEMCACHED_API
 memcached_return_t memcached_pool_behavior_set(memcached_pool_st *ptr,
index 5a820d4f1d9a77609581cd65c34fd6db4cf5fc97..3fb00c98d96b4e655232501e9366b5c162bfbfe4 100644 (file)
@@ -1,5 +1,5 @@
 /* LibMemcached
- * Copyright (C) 2006-2009 Brian Aker 
+ * Copyright (C) 2006-2009 Brian Aker
  * All rights reserved.
  *
  * Use and distribution licensed under the BSD license.  See
index 4b0c12e51369cd4363529c65c14eee4bd2ca6833..2602fce31433c92c9a01a6d03b4ad1433a125a23 100644 (file)
@@ -1,5 +1,5 @@
 /* LibMemcached
- * Copyright (C) 2006-2009 Brian Aker 
+ * Copyright (C) 2006-2009 Brian Aker
  * All rights reserved.
  *
  * Use and distribution licensed under the BSD license.  See
@@ -37,7 +37,7 @@ void memcached_result_free(memcached_result_st *result);
 LIBMEMCACHED_API
 void memcached_result_reset(memcached_result_st *ptr);
 LIBMEMCACHED_API
-memcached_result_st *memcached_result_create(memcached_st *ptr, 
+memcached_result_st *memcached_result_create(memcached_st *ptr,
                                              memcached_result_st *result);
 #define memcached_result_key_value(A) (A)->key
 #define memcached_result_key_length(A) (A)->key_length
index 2cff36da2eedf007a0c3d163137a2cf169151b77..814962c76675f8d47ed8b34d301c2262a5411b66 100644 (file)
@@ -18,7 +18,7 @@ memcached_server_st *memcached_server_create(memcached_st *memc, memcached_serve
 {
   if (ptr == NULL)
   {
-    ptr= (memcached_server_st *)calloc(1, sizeof(memcached_server_st));
+    ptr= (memcached_server_st *)memc->call_calloc(memc, 1, sizeof(memcached_server_st));
 
     if (!ptr)
       return NULL; /*  MEMCACHED_MEMORY_ALLOCATION_FAILURE */
index f2d92dc1249517776ed1c34d6e1a7d187c5ab62c..0e38fdd1e488a33e5e32041c9158ce77503b805e 100644 (file)
@@ -60,8 +60,10 @@ memcached_return_t memcached_server_cursor(memcached_st *ptr,
                                            uint32_t number_of_callbacks);
 
 LIBMEMCACHED_API
-memcached_server_st *memcached_server_by_key(memcached_st *ptr,  const char *key,
-                                             size_t key_length, memcached_return_t *error);
+memcached_server_st *memcached_server_by_key(memcached_st *ptr,
+                                             const char *key,
+                                             size_t key_length,
+                                             memcached_return_t *error);
 
 LIBMEMCACHED_API
 const char *memcached_server_error(memcached_server_st *ptr);
@@ -76,16 +78,23 @@ LIBMEMCACHED_API
 memcached_server_st *memcached_server_create(memcached_st *memc, memcached_server_st *ptr);
 
 LIBMEMCACHED_API
-memcached_server_st *memcached_server_create_with(memcached_st *memc, memcached_server_st *host,
-                                                  const char *hostname, in_port_t port,
-                                                  uint32_t weight, memcached_connection_t type);
+memcached_server_st *memcached_server_create_with(memcached_st *memc,
+                                                  memcached_server_st *host,
+                                                  const char *hostname,
+                                                  in_port_t port,
+                                                  uint32_t weight,
+                                                  memcached_connection_t type);
 
 LIBMEMCACHED_API
 void memcached_server_free(memcached_server_st *ptr);
+
 LIBMEMCACHED_API
-memcached_server_st *memcached_server_clone(memcached_server_st *clone, memcached_server_st *ptr);
+memcached_server_st *memcached_server_clone(memcached_server_st *clone,
+                                            memcached_server_st *ptr);
+
 LIBMEMCACHED_API
-memcached_analysis_st *memcached_analyze(memcached_st *memc, memcached_stat_st *memc_stat,
+memcached_analysis_st *memcached_analyze(memcached_st *memc,
+                                         memcached_stat_st *memc_stat,
                                          memcached_return_t *error);
 
 LIBMEMCACHED_API
index ec982ba0bf0689054bb06e20aae434c5bceb4c37..8f2339677affce816c7830807099ebad02356c46 100644 (file)
@@ -1,5 +1,5 @@
 /* LibMemcached
- * Copyright (C) 2006-2009 Brian Aker 
+ * Copyright (C) 2006-2009 Brian Aker
  * All rights reserved.
  *
  * Use and distribution licensed under the BSD license.  See
@@ -20,85 +20,85 @@ extern "C" {
 
 /* All of the functions for adding data to the server */
 LIBMEMCACHED_API
-memcached_return_t memcached_set(memcached_st *ptr, const char *key, size_t key_length, 
-                                 const char *value, size_t value_length, 
+memcached_return_t memcached_set(memcached_st *ptr, const char *key, size_t key_length,
+                                 const char *value, size_t value_length,
                                  time_t expiration,
                                  uint32_t  flags);
 LIBMEMCACHED_API
 memcached_return_t memcached_add(memcached_st *ptr, const char *key, size_t key_length,
-                                 const char *value, size_t value_length, 
+                                 const char *value, size_t value_length,
                                  time_t expiration,
                                  uint32_t  flags);
 LIBMEMCACHED_API
 memcached_return_t memcached_replace(memcached_st *ptr, const char *key, size_t key_length,
-                                     const char *value, size_t value_length, 
+                                     const char *value, size_t value_length,
                                      time_t expiration,
                                      uint32_t  flags);
 LIBMEMCACHED_API
-memcached_return_t memcached_append(memcached_st *ptr, 
+memcached_return_t memcached_append(memcached_st *ptr,
                                     const char *key, size_t key_length,
-                                    const char *value, size_t value_length, 
+                                    const char *value, size_t value_length,
                                     time_t expiration,
                                     uint32_t flags);
 LIBMEMCACHED_API
-memcached_return_t memcached_prepend(memcached_st *ptr, 
+memcached_return_t memcached_prepend(memcached_st *ptr,
                                      const char *key, size_t key_length,
-                                     const char *value, size_t value_length, 
+                                     const char *value, size_t value_length,
                                      time_t expiration,
                                      uint32_t flags);
 LIBMEMCACHED_API
-memcached_return_t memcached_cas(memcached_st *ptr, 
+memcached_return_t memcached_cas(memcached_st *ptr,
                                  const char *key, size_t key_length,
-                                 const char *value, size_t value_length, 
+                                 const char *value, size_t value_length,
                                  time_t expiration,
                                  uint32_t flags,
                                  uint64_t cas);
 
 LIBMEMCACHED_API
-memcached_return_t memcached_set_by_key(memcached_st *ptr, 
-                                        const char *master_key, size_t master_key_length, 
-                                        const char *key, size_t key_length, 
-                                        const char *value, size_t value_length, 
+memcached_return_t memcached_set_by_key(memcached_st *ptr,
+                                        const char *master_key, size_t master_key_length,
+                                        const char *key, size_t key_length,
+                                        const char *value, size_t value_length,
                                         time_t expiration,
                                         uint32_t flags);
 
 LIBMEMCACHED_API
-memcached_return_t memcached_add_by_key(memcached_st *ptr, 
+memcached_return_t memcached_add_by_key(memcached_st *ptr,
                                         const char *master_key, size_t master_key_length,
                                         const char *key, size_t key_length,
-                                        const char *value, size_t value_length, 
+                                        const char *value, size_t value_length,
                                         time_t expiration,
                                         uint32_t flags);
 
 LIBMEMCACHED_API
-memcached_return_t memcached_replace_by_key(memcached_st *ptr, 
+memcached_return_t memcached_replace_by_key(memcached_st *ptr,
                                             const char *master_key, size_t master_key_length,
                                             const char *key, size_t key_length,
-                                            const char *value, size_t value_length, 
+                                            const char *value, size_t value_length,
                                             time_t expiration,
                                             uint32_t flags);
 
 LIBMEMCACHED_API
-memcached_return_t memcached_prepend_by_key(memcached_st *ptr, 
+memcached_return_t memcached_prepend_by_key(memcached_st *ptr,
                                             const char *master_key, size_t master_key_length,
                                             const char *key, size_t key_length,
-                                            const char *value, size_t value_length, 
+                                            const char *value, size_t value_length,
                                             time_t expiration,
                                             uint32_t flags);
 
 LIBMEMCACHED_API
-memcached_return_t memcached_append_by_key(memcached_st *ptr, 
+memcached_return_t memcached_append_by_key(memcached_st *ptr,
                                            const char *master_key, size_t master_key_length,
                                            const char *key, size_t key_length,
-                                           const char *value, size_t value_length, 
+                                           const char *value, size_t value_length,
                                            time_t expiration,
                                            uint32_t flags);
 
 LIBMEMCACHED_API
-memcached_return_t memcached_cas_by_key(memcached_st *ptr, 
+memcached_return_t memcached_cas_by_key(memcached_st *ptr,
                                         const char *master_key, size_t master_key_length,
                                         const char *key, size_t key_length,
-                                        const char *value, size_t value_length, 
+                                        const char *value, size_t value_length,
                                         time_t expiration,
                                         uint32_t flags,
                                         uint64_t cas);
index 58f0887afeba861249f7af15e46e840aafeb888a..e01a47ebc9c7baf6f70035bbb33a3f74d618df69 100644 (file)
@@ -38,7 +38,9 @@ typedef memcached_return_t (*memcached_trigger_delete_key_fn)(memcached_st *ptr,
                                                               const char *key, size_t key_length);
 
 typedef memcached_return_t (*memcached_dump_fn)(memcached_st *ptr,
-                                                  const char *key, size_t key_length, void *context);
+                                                const char *key,
+                                                size_t key_length,
+                                                void *context);
 
 typedef struct {
   memcached_execute_fn *callback;