summaryrefslogtreecommitdiffstats
path: root/memcached-build.patch
blob: 1581e081e54d764c348bcbe78ed6b55de45bd132 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 74542111f175fe2ec41c8bf722fc2cd3dac93eea Mon Sep 17 00:00:00 2001
From: Andrei Zmievski <andrei@zmievski.org>
Date: Sun, 30 Sep 2012 11:09:01 -0700
Subject: [PATCH] Fix version access for libmemcached older than 1.0.8.

---
 php_memcached.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/php_memcached.c b/php_memcached.c
index 90ea8ab..7e6041a 100644
--- a/php_memcached.c
+++ b/php_memcached.c
@@ -2642,10 +2642,17 @@ static memcached_return php_memc_do_version_callback(const memcached_st *ptr, me
 	struct callbackContext* context = (struct callbackContext*) in_context;
 
 	hostport_len = spprintf(&hostport, 0, "%s:%d", memcached_server_name(instance), memcached_server_port(instance));
+#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX >= 0x01000008
 	version_len = snprintf(version, sizeof(version), "%d.%d.%d",
 				memcached_server_major_version(instance),
 				memcached_server_minor_version(instance),
 				memcached_server_micro_version(instance));
+#else
+	version_len = snprintf(version, sizeof(version), "%d.%d.%d",
+				instance->major_version,
+				instance->minor_version,
+				instance->micro_version);
+#endif
 
 	add_assoc_stringl_ex(context->return_value, hostport, hostport_len+1, version, version_len, 1);
 	efree(hostport);
-- 
1.7.10