From 2fc27acf7d450bbae9e90467f5931dece550d3fb Mon Sep 17 00:00:00 2001 From: Trond Norbye Date: Mon, 5 Oct 2009 19:53:47 +0200 Subject: [PATCH] Fix compilation failure on 32 bit systems caused by macro redefinition --- example/interface_v0.c | 1 + example/interface_v1.c | 1 + example/memcached_light.c | 9 ++++++++- example/storage.c | 17 +++++++++-------- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/example/interface_v0.c b/example/interface_v0.c index 1fb5a0a9..905b6ff5 100644 --- a/example/interface_v0.c +++ b/example/interface_v0.c @@ -4,6 +4,7 @@ * in the protocol library. You might want to have your copy of the protocol * specification next to your coffee ;-) */ +#include "config.h" #include #include #include diff --git a/example/interface_v1.c b/example/interface_v1.c index bab1cd97..4ebc43db 100644 --- a/example/interface_v1.c +++ b/example/interface_v1.c @@ -8,6 +8,7 @@ * you will not receive the next command before a answer to the previous * command is being sent. */ +#include "config.h" #include #include #include diff --git a/example/memcached_light.c b/example/memcached_light.c index 4343b835..cac0cf9a 100644 --- a/example/memcached_light.c +++ b/example/memcached_light.c @@ -15,8 +15,15 @@ * the more "logical" interface. * memcached_light.c - This file sets up all of the sockets and run the main * message loop. + * + * + * config.h is included so that I can use the ntohll/htonll on platforms that + * doesn't have that (this is a private function inside libmemcached, so you + * cannot use it directly from libmemcached without special modifications to + * the library) */ +#include "config.h" #include #include #include @@ -286,7 +293,7 @@ int main(int argc, char **argv) return 0; } -static void work(void) +static void work(void) { #define MAX_SERVERS_TO_POLL 100 struct pollfd fds[MAX_SERVERS_TO_POLL]; diff --git a/example/storage.c b/example/storage.c index 39b22caf..84894476 100644 --- a/example/storage.c +++ b/example/storage.c @@ -1,4 +1,5 @@ /* -*- Mode: C; tab-width: 2; c-basic-offset: 2; indent-tabs-mode: nil -*- */ +#include "config.h" #include #include #include @@ -15,17 +16,17 @@ struct list_entry { static struct list_entry *root; static uint64_t cas; -bool initialize_storage(void) +bool initialize_storage(void) { return true; } -void shutdown_storage(void) +void shutdown_storage(void) { /* Do nothing */ } -void put_item(struct item* item) +void put_item(struct item* item) { struct list_entry* entry= (void*)item; @@ -46,7 +47,7 @@ void put_item(struct item* item) root= entry; } -struct item* get_item(const void* key, size_t nkey) +struct item* get_item(const void* key, size_t nkey) { struct list_entry *walker= root; @@ -104,7 +105,7 @@ struct item* create_item(const void* key, size_t nkey, const void* data, return ret; } -bool delete_item(const void* key, size_t nkey) +bool delete_item(const void* key, size_t nkey) { struct item* item= get_item(key, nkey); bool ret= false; @@ -137,7 +138,7 @@ bool delete_item(const void* key, size_t nkey) return ret; } -void flush(uint32_t when) +void flush(uint32_t when) { /* FIXME */ (void)when; @@ -159,12 +160,12 @@ void flush(uint32_t when) } } -void update_cas(struct item* item) +void update_cas(struct item* item) { item->cas= ++cas; } -void release_item(struct item* item __attribute__((unused))) +void release_item(struct item* item __attribute__((unused))) { /* EMPTY */ } -- 2.30.2