Permalink
Browse files

Drop libmemcached 0.x series support, release 2.1.0.

  • Loading branch information...
1 parent 9f86643 commit 47172e18a19bcfb5b847336a1ec4b42215fcdfc1 @andreiz andreiz committed Aug 7, 2012
Showing with 31 additions and 34 deletions.
  1. +6 −0 ChangeLog
  2. +11 −12 config.m4
  3. +2 −11 php_libmemcached_compat.h
  4. +10 −8 php_memcached.c
  5. +2 −2 php_memcached.h
  6. +0 −1 php_memcached_session.c
View
@@ -1,5 +1,11 @@
memcached extension changelog
+Version 2.1.0
+-------------
+ * Drop support for libmemcached 0.x series, now 1.0.x is required
+ * Add support for virtual bucket distribution
+ * Fix compilation against PHP 5.2
+
Version 2.0.1
-------------
* Fix embedded version number to be not -dev
View
@@ -216,11 +216,16 @@ if test "$PHP_MEMCACHED" != "no"; then
AC_MSG_RESULT([disabled])
fi
+ if test "$PHP_MEMCACHED_SASL" != "no"; then
+ AC_CHECK_HEADERS([sasl/sasl.h], [memcached_enable_sasl="yes"], [memcached_enable_sasl="no"])
+ AC_MSG_CHECKING([whether to enable sasl support])
+ AC_MSG_RESULT([$memcached_enable_sasl])
+ fi
+
+ AC_MSG_CHECKING([for libmemcached location])
if test "$PHP_LIBMEMCACHED_DIR" != "no" && test "$PHP_LIBMEMCACHED_DIR" != "yes"; then
- if test -r "$PHP_LIBMEMCACHED_DIR/include/libmemcached/memcached.h"; then
- PHP_LIBMEMCACHED_DIR="$PHP_LIBMEMCACHED_DIR"
- else
- AC_MSG_ERROR([Can't find libmemcached headers under "$PHP_LIBMEMCACHED_DIR"])
+ if ! test -r "$PHP_LIBMEMCACHED_DIR/include/libmemcached-1.0/memcached.h"; then
+ AC_MSG_ERROR([Can't find libmemcached 1.0.x headers under "$PHP_LIBMEMCACHED_DIR"])
fi
else
PHP_LIBMEMCACHED_DIR="no"
@@ -232,17 +237,11 @@ if test "$PHP_MEMCACHED" != "no"; then
done
fi
- if test "$PHP_MEMCACHED_SASL" != "no"; then
- AC_CHECK_HEADERS([sasl/sasl.h], [memcached_enable_sasl="yes"], [memcached_enable_sasl="no"])
- AC_MSG_CHECKING([whether to enable sasl support])
- AC_MSG_RESULT([$memcached_enable_sasl])
- fi
-
- AC_MSG_CHECKING([for libmemcached location])
if test "$PHP_LIBMEMCACHED_DIR" = "no"; then
- AC_MSG_ERROR([memcached support requires libmemcached. Use --with-libmemcached-dir=<DIR> to specify the prefix where libmemcached headers and library are located])
+ AC_MSG_ERROR([memcached support requires libmemcached 1.0.x. Use --with-libmemcached-dir=<DIR> to specify the prefix where libmemcached headers and library are located])
else
AC_MSG_RESULT([$PHP_LIBMEMCACHED_DIR])
+
PHP_LIBMEMCACHED_INCDIR="$PHP_LIBMEMCACHED_DIR/include"
PHP_ADD_INCLUDE($PHP_LIBMEMCACHED_INCDIR)
PHP_ADD_LIBRARY_WITH_PATH(memcached, $PHP_LIBMEMCACHED_DIR/$PHP_LIBDIR, MEMCACHED_SHARED_LIBADD)
View
@@ -1,16 +1,7 @@
-/*
- * Here we define backwards compatibility for older
- * libmemcached API:s
- *
- * // Teddy Grenman <teddy.grenman@iki.fi>
- */
-
#ifndef PHP_LIBMEMCACHED_COMPAT
#define PHP_LIBMEMCACHED_COMPAT
-#if !defined(LIBMEMCACHED_VERSION_HEX) || LIBMEMCACHED_VERSION_HEX < 0x00039000
-/* definition from libmemcached/types.h version 0.39+ */
-typedef const struct memcached_server_st *memcached_server_instance_st;
-#endif
+/* this is the version(s) we support */
+#include <libmemcached-1.0/memcached.h>
#endif
View
@@ -43,9 +43,7 @@
#include <ext/standard/php_smart_str.h>
#include <ext/standard/php_var.h>
#include <ext/standard/basic_functions.h>
-#include <libmemcached/memcached.h>
-#include "php_libmemcached_compat.h"
#include "php_memcached.h"
#include "g_fmt.h"
@@ -2582,9 +2580,12 @@ static memcached_return php_memc_do_serverlist_callback(const memcached_st *ptr,
MAKE_STD_ZVAL(array);
array_init(array);
- add_assoc_string(array, "host", instance->hostname, 1);
- add_assoc_long(array, "port", instance->port);
+ add_assoc_string(array, "host", memcached_server_name(instance), 1);
+ add_assoc_long(array, "port", memcached_server_port(instance));
+ /*
+ * API does not allow to get at this field.
add_assoc_long(array, "weight", instance->weight);
+ */
add_next_index_zval(context->return_value, array);
return MEMCACHED_SUCCESS;
}
@@ -2595,7 +2596,7 @@ static memcached_return php_memc_do_stats_callback(const memcached_st *ptr, memc
int hostport_len;
struct callbackContext* context = (struct callbackContext*) in_context;
zval *entry;
- hostport_len = spprintf(&hostport, 0, "%s:%d", instance->hostname, instance->port);
+ hostport_len = spprintf(&hostport, 0, "%s:%d", memcached_server_name(instance), memcached_server_port(instance));
MAKE_STD_ZVAL(entry);
array_init(entry);
@@ -2640,10 +2641,11 @@ static memcached_return php_memc_do_version_callback(const memcached_st *ptr, me
int hostport_len, version_len;
struct callbackContext* context = (struct callbackContext*) in_context;
- hostport_len = spprintf(&hostport, 0, "%s:%d", instance->hostname, instance->port);
+ hostport_len = spprintf(&hostport, 0, "%s:%d", memcached_server_name(instance), memcached_server_port(instance));
version_len = snprintf(version, sizeof(version), "%d.%d.%d",
- instance->major_version, instance->minor_version,
- instance->micro_version);
+ memcached_server_major_version(instance),
+ memcached_server_minor_version(instance),
+ memcached_server_micro_version(instance));
add_assoc_stringl_ex(context->return_value, hostport, hostport_len+1, version, version_len, 1);
efree(hostport);
View
@@ -19,7 +19,7 @@
#ifndef PHP_MEMCACHED_H
#define PHP_MEMCACHED_H
-#include <libmemcached/memcached.h>
+#include "php_libmemcached_compat.h"
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -91,7 +91,7 @@ PHP_MINIT_FUNCTION(memcached);
PHP_MSHUTDOWN_FUNCTION(memcached);
PHP_MINFO_FUNCTION(memcached);
-#define PHP_MEMCACHED_VERSION "2.0.1"
+#define PHP_MEMCACHED_VERSION "2.1.0"
#ifdef ZTS
#define MEMC_G(v) TSRMG(php_memcached_globals_id, zend_php_memcached_globals *, v)
View
@@ -30,7 +30,6 @@
#include <zend_exceptions.h>
#include <ext/standard/php_smart_str.h>
#include <ext/standard/php_var.h>
-#include <libmemcached/memcached.h>
#include "php_memcached.h"
#include "php_memcached_session.h"

0 comments on commit 47172e1

Please sign in to comment.