]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Backport SKIP_BACK with type control from v3
authorIgor Putovny <igor.putovny@nic.cz>
Thu, 30 May 2024 10:27:54 +0000 (12:27 +0200)
committerIgor Putovny <igor.putovny@nic.cz>
Thu, 30 May 2024 10:27:54 +0000 (12:27 +0200)
lib/birdlib.h

index c1090417a34dc1df9f42d6b5386a83997d4aa958..3460389bf615558f908d8bcb95b4679dfcaa2c9c 100644 (file)
@@ -19,7 +19,7 @@
 struct align_probe { char x; long int y; };
 
 #define OFFSETOF(s, i) ((size_t) &((s *)0)->i)
-#define SKIP_BACK(s, i, p) ((s *)((char *)p - OFFSETOF(s, i)))
+#define SKIP_BACK(s, i, p) ({ s *_ptr = ((s *)((char *)p - OFFSETOF(s, i))); SAME_TYPE(&_ptr->i, p); _ptr; })
 #define BIRD_ALIGN(s, a) (((s)+a-1)&~(a-1))
 #define CPU_STRUCT_ALIGN (sizeof(struct align_probe))