]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Move SUBTYPE_P into compat_compiler.h
authorNick Mathewson <nickm@torproject.org>
Fri, 29 Jun 2018 14:23:52 +0000 (10:23 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 29 Jun 2018 16:21:52 +0000 (12:21 -0400)
src/common/util.h
src/lib/cc/compat_compiler.h

index c59c79c30ef4795767f43f9865e70ab9fbb6ab19..032842d8dc4738f37a934da4b0e5cac9b0288949 100644 (file)
 #include "lib/encoding/cstring.h"
 #include "lib/fs/winlib.h"
 
-/** Macro: yield a pointer to an enclosing structure given a pointer to
- * a substructure at offset <b>off</b>. Example:
- * <pre>
- *   struct base { ... };
- *   struct subtype { int x; struct base b; } x;
- *   struct base *bp = &x.base;
- *   struct *sp = SUBTYPE_P(bp, struct subtype, b);
- * </pre>
- */
-#define SUBTYPE_P(p, subtype, basemember) \
-  ((void*) ( ((char*)(p)) - offsetof(subtype, basemember) ))
-
 /* Math functions */
 
 /* String manipulation */
index 67d945cfaf6c9ccb5382a36e170093da26bf9520..c631a7e821746210067fb0d0bc9a27a7c228b911 100644 (file)
  */
 #define STRUCT_VAR_P(st, off) ((void*) ( ((char*)(st)) + (off) ) )
 
+/** Macro: yield a pointer to an enclosing structure given a pointer to
+ * a substructure at offset <b>off</b>. Example:
+ * <pre>
+ *   struct base { ... };
+ *   struct subtype { int x; struct base b; } x;
+ *   struct base *bp = &x.base;
+ *   struct *sp = SUBTYPE_P(bp, struct subtype, b);
+ * </pre>
+ */
+#define SUBTYPE_P(p, subtype, basemember) \
+  ((void*) ( ((char*)(p)) - offsetof(subtype, basemember) ))
+
 /** Macro: Yields the number of elements in array x. */
 #define ARRAY_LENGTH(x) ((sizeof(x)) / sizeof(x[0]))