1
Description: Fix FTBFS with gcc 4.5
2
Origin: upstream, https://github.com/memcached/memcached/commit/df15887584f0025e7b188e408dd3c9f638d68518
3
Bug-Ubuntu: https://bugs.launchpad.net/bugs/687984
8
#define TAIL_REPAIR_TIME (3 * 3600)
10
/* warning: don't use these macros with a function, as it evals its arg twice */
11
-#define ITEM_get_cas(i) ((uint64_t)(((i)->it_flags & ITEM_CAS) ? \
12
- *(uint64_t*)&((i)->end[0]) : 0x0))
13
-#define ITEM_set_cas(i,v) { if ((i)->it_flags & ITEM_CAS) { \
14
- *(uint64_t*)&((i)->end[0]) = v; } }
15
+#define ITEM_get_cas(i) (((i)->it_flags & ITEM_CAS) ? \
16
+ (i)->data->cas : (uint64_t)0)
18
-#define ITEM_key(item) (((char*)&((item)->end[0])) \
19
+#define ITEM_set_cas(i,v) { \
20
+ if ((i)->it_flags & ITEM_CAS) { \
21
+ (i)->data->cas = v; \
25
+#define ITEM_key(item) (((char*)&((item)->data)) \
26
+ (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0))
28
-#define ITEM_suffix(item) ((char*) &((item)->end[0]) + (item)->nkey + 1 \
29
+#define ITEM_suffix(item) ((char*) &((item)->data) + (item)->nkey + 1 \
30
+ (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0))
32
-#define ITEM_data(item) ((char*) &((item)->end[0]) + (item)->nkey + 1 \
33
+#define ITEM_data(item) ((char*) &((item)->data) + (item)->nkey + 1 \
35
+ (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0))
38
uint8_t it_flags; /* ITEM_* above */
39
uint8_t slabs_clsid;/* which slab class we're in */
40
uint8_t nkey; /* key length, w/terminating null and padding */
42
+ /* this odd type prevents type-punning issues when we do
43
+ * the little shuffle to save space when not using CAS. */
48
/* if it_flags & ITEM_CAS we have 8 bytes CAS */
49
/* then null-terminated key */
50
/* then " flags length\r\n" (no terminating null) */