Update for sasl fixes.
authorBrian Aker <brian@tangent.org>
Tue, 14 Feb 2012 00:01:42 +0000 (16:01 -0800)
committerBrian Aker <brian@tangent.org>
Tue, 14 Feb 2012 00:01:42 +0000 (16:01 -0800)
configure.ac
libmemcached/io.cc
libmemcached/key.cc
libmemcached/response.cc
libmemcached/sasl.cc
m4/ax_sasl.m4
tests/libmemcached-1.0/atomsmasher.cc
tests/libmemcached-1.0/ketama.cc
tests/libmemcached-1.0/mem_functions.cc

index 53caf24162f6acd72813a60ead610f9a7715c906..217626cd17eff1e6c1b4e93ed420f476c1cf1d30 100644 (file)
@@ -127,7 +127,6 @@ AC_CHECK_HEADERS([netdb.h])
 AC_CHECK_HEADERS([netinet/in.h])
 AC_CHECK_HEADERS([stddef.h])
 AC_CHECK_HEADERS([sys/time.h])
-AC_CHECK_HEADERS([sasl/sasl.h])
 AC_CHECK_HEADERS([execinfo.h])
 AC_CHECK_HEADERS([cxxabi.h], 
                  AC_DEFINE([HAVE_CXXABI_H], [1], [Have cxxabi.h]),
index 50fa77ae404dd256d0e9e2daa2c76d4e1fad60d2..48c0de6c7c2d81620d8c3d5d1cbd2dae80b3e382 100644 (file)
@@ -722,7 +722,7 @@ memcached_server_write_instance_st memcached_io_get_readable_server(memcached_st
     break;
 
   default:
-    for (size_t x= 0; x < host_index; ++x)
+    for (ptrdiff_t x= 0; x < host_index; ++x)
     {
       if (fds[x].revents & POLLIN)
       {
index 39c1455be67b51d02260a7ea02b0492bc86a461b..19d1f957acefc01214ac2ffdaa2198e613d05093 100644 (file)
@@ -51,7 +51,7 @@ memcached_return_t memcached_key_test(memcached_st &memc,
   // we just check the size of the key
   if (memc.flags.verify_key == false or memc.flags.binary_protocol == true)
   {
-    for (uint32_t x= 0; x < number_of_keys; x++)
+    for (size_t x= 0; x < number_of_keys; x++)
     {
       // We should set binary key, but the memcached server is broken for
       // longer keys at the moment.
@@ -65,7 +65,7 @@ memcached_return_t memcached_key_test(memcached_st &memc,
     return MEMCACHED_SUCCESS;
   }
 
-  for (uint32_t x= 0; x < number_of_keys; x++)
+  for (size_t x= 0; x < number_of_keys; x++)
   {
     memcached_return_t rc= memcached_validate_key_length(*(key_length + x), false);
     if (memcached_failed(rc))
index 69ac26a4ac54ae6fa1057a8910f7013f6e7c7363..511cf786db0bbfb5151ef2fc024eae5a4ed121bc 100644 (file)
@@ -60,7 +60,7 @@ static memcached_return_t textual_value_fetch(memcached_server_write_instance_st
     char *key= result->item_key;
     result->key_length= 0;
 
-    for (size_t prefix_length= memcached_array_size(instance->root->_namespace); !(iscntrl(*string_ptr) || isspace(*string_ptr)) ; string_ptr++)
+    for (ptrdiff_t prefix_length= memcached_array_size(instance->root->_namespace); !(iscntrl(*string_ptr) || isspace(*string_ptr)) ; string_ptr++)
     {
       if (prefix_length == 0)
       {
index ce61e3182f93421c5d1fc7c562d957e467df50a5..40d37e3a6e9f165743f22e56fc84803b5f35cbcf 100644 (file)
@@ -427,7 +427,7 @@ memcached_return_t memcached_clone_sasl(memcached_st *clone, const  memcached_st
    * into the list, but if we don't know the ID we don't know how to handle
    * the context...
  */
-  size_t total= 0;
+  ptrdiff_t total= 0;
 
   while (source->sasl.callbacks[total].id != SASL_CB_LIST_END)
   {
@@ -453,7 +453,7 @@ memcached_return_t memcached_clone_sasl(memcached_st *clone, const  memcached_st
   memcpy(callbacks, source->sasl.callbacks, (total + 1) * sizeof(sasl_callback_t));
 
   /* Now update the context... */
-  for (size_t x= 0; x < total; ++x)
+  for (ptrdiff_t x= 0; x < total; ++x)
   {
     if (callbacks[x].id == SASL_CB_USER || callbacks[x].id == SASL_CB_AUTHNAME)
     {
@@ -462,7 +462,7 @@ memcached_return_t memcached_clone_sasl(memcached_st *clone, const  memcached_st
       if (callbacks[x].context == NULL)
       {
         /* Failed to allocate memory, clean up previously allocated memory */
-        for (size_t y= 0; y < x; ++y)
+        for (ptrdiff_t y= 0; y < x; ++y)
         {
           libmemcached_free(clone, clone->sasl.callbacks[y].context);
         }
@@ -479,7 +479,7 @@ memcached_return_t memcached_clone_sasl(memcached_st *clone, const  memcached_st
       if (n == NULL)
       {
         /* Failed to allocate memory, clean up previously allocated memory */
-        for (size_t y= 0; y < x; ++y)
+        for (ptrdiff_t y= 0; y < x; ++y)
         {
           libmemcached_free(clone, clone->sasl.callbacks[y].context);
         }
index c11efb9c396cfaec0a9d95aa8ee622565b32e5a5..5cfa47ddbfd9553ad50b208d522a1f8228c10159 100644 (file)
@@ -29,12 +29,12 @@ AC_DEFUN([AX_SASL_OPTION],[
       [ac_enable_sasl="yes"])
 
     AS_IF([test "x$ac_enable_sasl" = "xyes"], [
-      AS_IF([test "x$ax_cv_sasl" = "xyes"], [
-        AC_DEFINE([HAVE_LIBSASL], [ 1 ], [Have libsasl2])
-        ], [
-        AC_DEFINE([HAVE_LIBSASL], [ 0 ], [Have libsasl2])
-        ac_enable_sasl= no 
-        ])
+      ac_enable_sasl="no"
+      ], [
+      ])
+
+    AS_IF([test "x$ac_enable_sasl" = "xyes"], [
+      AC_DEFINE([HAVE_LIBSASL], [ 1 ], [Have libsasl2])
       ], [
       AC_DEFINE([HAVE_LIBSASL], [ 0 ], [Have libsasl2])
       ])
index bab25d031c04e4d9af33d7602b2da261b90b0566..fd3dc46e82f1866cf1eb952e2fe9ab272e97944f 100644 (file)
@@ -59,7 +59,7 @@ static test_return_t generate_pairs(memcached_st *)
   global_pairs= pairs_generate(GLOBAL_COUNT, 400);
   global_count= GLOBAL_COUNT;
 
-  for (size_t x= 0; x < global_count; x++)
+  for (ptrdiff_t x= 0; x < global_count; x++)
   {
     global_keys[x]= global_pairs[x].key;
     global_keys_length[x]=  global_pairs[x].key_length;
@@ -71,7 +71,7 @@ static test_return_t generate_pairs(memcached_st *)
 static test_return_t drizzle(memcached_st *memc)
 {
 infinite:
-  for (size_t x= 0; x < TEST_COUNTER; x++)
+  for (ptrdiff_t x= 0; x < TEST_COUNTER; x++)
   {
     memcached_return_t rc;
     char *return_value;
@@ -174,7 +174,7 @@ static test_return_t add_test(memcached_st *memc)
 static test_return_t many_adds(memcached_st *memc)
 {
   test_true(memc);
-  for (size_t x= 0; x < TEST_COUNTER; x++)
+  for (ptrdiff_t x= 0; x < TEST_COUNTER; x++)
   {
     test_compare_got(TEST_SUCCESS, add_test(memc), x);
   }
@@ -203,7 +203,7 @@ static test_return_t memcached_create_benchmark(memcached_st *)
 {
   benchmark_state.create_init= true;
 
-  for (size_t x= 0; x < BENCHMARK_TEST_LOOP; x++)
+  for (ptrdiff_t x= 0; x < BENCHMARK_TEST_LOOP; x++)
   {
     memcached_st *ptr;
     ptr= memcached_create(&benchmark_state.create[x]);
@@ -218,10 +218,9 @@ static test_return_t memcached_clone_benchmark(memcached_st *memc)
 {
   benchmark_state.clone_init= true;
 
-  for (size_t x= 0; x < BENCHMARK_TEST_LOOP; x++)
+  for (ptrdiff_t x= 0; x < BENCHMARK_TEST_LOOP; x++)
   {
-    memcached_st *ptr;
-    ptr= memcached_clone(&benchmark_state.clone[x], memc);
+    memcached_st *ptr= memcached_clone(&benchmark_state.clone[x], memc);
 
     test_true(ptr);
   }
@@ -243,7 +242,7 @@ static test_return_t pre_allocate(memcached_st *)
 
 static test_return_t post_allocate(memcached_st *)
 {
-  for (size_t x= 0; x < BENCHMARK_TEST_LOOP; x++)
+  for (ptrdiff_t x= 0; x < BENCHMARK_TEST_LOOP; x++)
   {
     if (benchmark_state.create_init)
     {
index 82237343d12256b07511de6397fff47dcb91fdd9..939236aac9326dffbce6d6d32bb602098c05ab88 100644 (file)
@@ -207,7 +207,7 @@ test_return_t auto_eject_hosts(memcached_st *trash)
   /*
     This would not work if there were only two hosts.
   */
-  for (size_t x= 0; x < 99; x++)
+  for (ptrdiff_t x= 0; x < 99; x++)
   {
     memcached_autoeject(memc);
     uint32_t server_idx= memcached_generate_hash(memc, ketama_test_cases[x].key, strlen(ketama_test_cases[x].key));
@@ -219,7 +219,7 @@ test_return_t auto_eject_hosts(memcached_st *trash)
   memc->ketama.next_distribution_rebuild= time(NULL) - 1;
   memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_DISTRIBUTION,
                          memc->distribution);
-  for (size_t x= 0; x < 99; x++)
+  for (ptrdiff_t x= 0; x < 99; x++)
   {
     uint32_t server_idx = memcached_generate_hash(memc, ketama_test_cases[x].key, strlen(ketama_test_cases[x].key));
     // We re-use instance from above.
index 3707c6b3450042b99110359acc863044ce9c3ee1..7f8342da029b31f4e8dacacba883d4a5fcf8c34a 100644 (file)
@@ -721,7 +721,7 @@ test_return_t memcached_mget_mixed_memcached_get_TEST(memcached_st *memc)
                                time_t(0), uint32_t(0)));
   }
 
-  for (size_t loop= 0; loop < 20; loop++)
+  for (ptrdiff_t loop= 0; loop < 20; loop++)
   {
     if (random() %2)
     {
@@ -1989,7 +1989,7 @@ test_return_t key_teardown(memcached_st *)
 test_return_t block_add_regression(memcached_st *memc)
 {
   /* First add all of the items.. */
-  for (size_t x= 0; x < REGRESSION_BINARY_VS_BLOCK_COUNT; ++x)
+  for (ptrdiff_t x= 0; x < REGRESSION_BINARY_VS_BLOCK_COUNT; ++x)
   {
     char blob[1024] = {0};
 
@@ -2701,7 +2701,7 @@ test_return_t user_supplied_bug14(memcached_st *memc)
 
   libtest::vchar_t value;
   value.reserve(18000);
-  for (size_t x= 0; x < 18000; x++)
+  for (ptrdiff_t x= 0; x < 18000; x++)
   {
     value.push_back((char) (x % 127));
   }