Commit 03e90f3e authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

cleanup.

parent 7f675db3
[buildout] [buildout]
parts = memcached parts = memcached
extends = ../libevent/buildout.cfg extends =
../autoconf/buildout.cfg
../automake/buildout.cfg
../libevent/buildout.cfg
[memcached-fix-array-subscript-is-above-array-bounds] [memcached-fix-array-subscript-is-above-array-bounds]
recipe = hexagonit.recipe.download recipe = hexagonit.recipe.download
...@@ -14,7 +17,7 @@ recipe = hexagonit.recipe.download ...@@ -14,7 +17,7 @@ recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename} url = ${:_profile_base_location_}/${:filename}
filename = memcached-gcc-4.4.patch filename = memcached-gcc-4.4.patch
download-only = true download-only = true
md5sum = 2fc9d0f26f52f0ddd4f38054b63cd4f1 md5sum = fd98d0cbfc4d3a25ac9808472fbe62f8
[memcached] [memcached]
recipe = hexagonit.recipe.cmmi recipe = hexagonit.recipe.cmmi
...@@ -23,8 +26,16 @@ md5sum = b7104e269511621c2777367d6d6315fe ...@@ -23,8 +26,16 @@ md5sum = b7104e269511621c2777367d6d6315fe
patches = patches =
${memcached-fix-array-subscript-is-above-array-bounds:location}/${memcached-fix-array-subscript-is-above-array-bounds:filename} ${memcached-gcc-4.4.patch:location}/${memcached-gcc-4.4.patch:filename} ${memcached-fix-array-subscript-is-above-array-bounds:location}/${memcached-fix-array-subscript-is-above-array-bounds:filename} ${memcached-gcc-4.4.patch:location}/${memcached-gcc-4.4.patch:filename}
patch-options = -p1 patch-options = -p1
configure-command =
aclocal-1.11
autoheader
automake-1.11 --foreign
autoconf
./configure
configure-options = configure-options =
--prefix=${buildout:parts-directory}/${:_buildout_section_name_}
--with-libevent=${libevent:location} --with-libevent=${libevent:location}
--disable-docs --disable-docs
environment = environment =
LDFLAGS =-Wl,-rpath=${libevent:location}/lib PATH=${autoconf:location}/bin:${automake-1.11:location}/bin:%(PATH)s
LDFLAGS =-Wl,-rpath=${libevent:location}/lib
diff -rdBu memcached-1.4.0-rc1/memcached.h memcached-1.4.0-my/memcached.h
--- memcached-1.4.0-rc1/memcached.h 2009-05-29 00:51:56.000000000 +0400
+++ memcached-1.4.0-my/memcached.h 2009-06-07 22:32:52.000000000 +0400
@@ -75,21 +75,21 @@
/* warning: don't use these macros with a function, as it evals its arg twice */
#define ITEM_get_cas(i) ((uint64_t)(((i)->it_flags & ITEM_CAS) ? \
- *(uint64_t*)&((i)->end[0]) : 0x0))
+ *(uint64_t*)((char*)(i) + sizeof(*i)) : 0x0))
#define ITEM_set_cas(i,v) { if ((i)->it_flags & ITEM_CAS) { \
- *(uint64_t*)&((i)->end[0]) = v; } }
+ *(uint64_t*)((char*)(i) + sizeof(*i)) = v; } }
-#define ITEM_key(item) (((char*)&((item)->end[0])) \
+#define ITEM_key(item) ((char*)(item) + sizeof(*item) \
+ (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0))
-#define ITEM_suffix(item) ((char*) &((item)->end[0]) + (item)->nkey + 1 \
+#define ITEM_suffix(item) ((char*)(item) + sizeof(*item) + (item)->nkey + 1 \
+ (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0))
-#define ITEM_data(item) ((char*) &((item)->end[0]) + (item)->nkey + 1 \
+#define ITEM_data(item) ((char*)(item) + sizeof(*item) + (item)->nkey + 1 \
+ (item)->nsuffix \
+ (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0))
-#define ITEM_ntotal(item) (sizeof(struct _stritem) + (item)->nkey + 1 \
+#define ITEM_ntotal(item) (sizeof(*item) + (item)->nkey + 1 \
+ (item)->nsuffix + (item)->nbytes \
+ (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0))
@@ -285,7 +285,6 @@
uint8_t it_flags; /* ITEM_* above */
uint8_t slabs_clsid;/* which slab class we're in */
uint8_t nkey; /* key length, w/terminating null and padding */
- void * end[];
/* if it_flags & ITEM_CAS we have 8 bytes CAS */
/* then null-terminated key */
/* then " flags length\r\n" (no terminating null) */
...@@ -10,14 +10,3 @@ ...@@ -10,14 +10,3 @@
CFLAGS="$CFLAGS -fno-strict-aliasing" CFLAGS="$CFLAGS -fno-strict-aliasing"
;; ;;
esac esac
--- memcached-1.4.8/configure.orig
+++ memcached-1.4.8/configure
@@ -6185,7 +6185,7 @@
GCC_VERSION=`$CC -dumpversion`
CFLAGS="$CFLAGS -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls"
case $GCC_VERSION in
- 4.4.*)
+ 4.4 | 4.4.*)
CFLAGS="$CFLAGS -fno-strict-aliasing"
;;
esac
diff --git a/items.c b/items.c
index e7f01ea..9fc6704 100644
--- a/items.c
+++ b/items.c
@@ -450,9 +450,7 @@ void do_item_stats_sizes(ADD_STAT add_stats, void *c) {
for (i = 0; i < num_buckets; i++) {
if (histogram[i] != 0) {
char key[8];
- int klen = 0;
- klen = snprintf(key, sizeof(key), "%d", i * 32);
- assert(klen < sizeof(key));
+ assert(snprintf(key, sizeof(key), "%d", i * 32) < sizeof(key));
APPEND_STAT(key, "%u", histogram[i]);
}
}
diff --git a/memcached.c b/memcached.c
index 750c8b3..0913b77 100644
--- a/memcached.c
+++ b/memcached.c
@@ -4627,8 +4627,6 @@ int main (int argc, char **argv) {
/* create the listening socket, bind it, and init */
if (settings.socketpath == NULL) {
- int udp_port;
-
const char *portnumber_filename = getenv("MEMCACHED_PORT_FILENAME");
char temp_portnumber_filename[PATH_MAX];
FILE *portnumber_file = NULL;
@@ -4658,7 +4656,6 @@ int main (int argc, char **argv) {
* then daemonise if needed, then init libevent (in some cases
* descriptors created by libevent wouldn't survive forking).
*/
- udp_port = settings.udpport ? settings.udpport : settings.port;
/* create the UDP listening socket and bind it */
errno = 0;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment