summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-10-21 10:40:07 +0200
committerThomas Haller <thaller@redhat.com>2020-10-21 10:40:07 +0200
commit991eec3842712ada049534c5a342a77d5cfe6080 (patch)
treeb81ce8e17fbfa15a2bba1fd4336683cc286db27b
parenta417583558b8a41305888908466ea006e05a4de4 (diff)
Squashed 'shared/c-rbtree/' changes from bd1c14dc0d93..3162c5c04574
3162c5c04574 build: synchronize AUTHORS c795b7657f4f c-rbtree: align CRBTree with CRBNode 10d973a9e671 c-rbtree: fix struct alignment of CRBTree on m68k architectures git-subtree-dir: shared/c-rbtree git-subtree-split: 3162c5c04574789144aff9de55c423cc8b636c85
-rw-r--r--AUTHORS2
-rw-r--r--src/c-rbtree.h13
2 files changed, 13 insertions, 2 deletions
diff --git a/AUTHORS b/AUTHORS
index b59660c5e..ed4e72e91 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -34,4 +34,6 @@ COPYRIGHT: (ordered alphabetically)
AUTHORS: (ordered alphabetically)
David Rheinsberg <david.rheinsberg@gmail.com>
+ Kay Sievers <kay@vrfy.org>
+ Thomas Haller <thaller@redhat.com>
Tom Gundersen <teg@jklm.no>
diff --git a/src/c-rbtree.h b/src/c-rbtree.h
index a9bbce52f..d4d0fe45c 100644
--- a/src/c-rbtree.h
+++ b/src/c-rbtree.h
@@ -27,6 +27,7 @@ extern "C" {
#endif
#include <assert.h>
+#include <stdalign.h>
#include <stddef.h>
typedef struct CRBNode CRBNode;
@@ -58,7 +59,11 @@ typedef struct CRBTree CRBTree;
* C_RBNODE_INIT.
*/
struct CRBNode {
- unsigned long __parent_and_flags;
+ union {
+ unsigned long __parent_and_flags;
+ /* enforce >=4-byte alignment for @__parent_and_flags */
+ alignas(4) unsigned char __align_dummy;
+ };
CRBNode *left;
CRBNode *right;
};
@@ -88,7 +93,11 @@ void c_rbnode_unlink_stale(CRBNode *n);
* To initialize an RB-Tree, set it to NULL / all zero.
*/
struct CRBTree {
- CRBNode *root;
+ union {
+ CRBNode *root;
+ /* enforce >=4-byte alignment for @root */
+ alignas(4) unsigned char __align_dummy;
+ };
};
#define C_RBTREE_INIT {}