~yolanda.robla/ubuntu/trusty/memcached/add_distribution

« back to all changes in this revision

Viewing changes to debian/patches/03_fix_ftbfs_gcc_45.patch

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2011-10-05 13:27:39 UTC
  • mfrom: (1.1.8 upstream) (3.3.4 sid)
  • Revision ID: james.westby@ubuntu.com-20111005132739-ntsnlj16fcze221i
Tags: 1.4.7-0.1ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Run as 'memcache' user instead of nobody (LP #599461)
  - Depend on adduser for preinst/postrm
  - Create user in postinst

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
4
 
 
5
 
--- a/memcached.h
6
 
+++ b/memcached.h
7
 
@@ -77,18 +77,22 @@
8
 
 #define TAIL_REPAIR_TIME (3 * 3600)
9
 
 
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)
17
 
 
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; \
22
 
+    } \
23
 
+}
24
 
+
25
 
+#define ITEM_key(item) (((char*)&((item)->data)) \
26
 
          + (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0))
27
 
 
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))
31
 
 
32
 
-#define ITEM_data(item) ((char*) &((item)->end[0]) + (item)->nkey + 1 \
33
 
+#define ITEM_data(item) ((char*) &((item)->data) + (item)->nkey + 1 \
34
 
          + (item)->nsuffix \
35
 
          + (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0))
36
 
 
37
 
@@ -302,7 +306,12 @@
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 */
41
 
-    void * end[];
42
 
+    /* this odd type prevents type-punning issues when we do
43
 
+     * the little shuffle to save space when not using CAS. */
44
 
+    union {
45
 
+        uint64_t cas;
46
 
+        char end;
47
 
+    } data[];
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) */