mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Move STRUCT_VAR_P to compat_compiler.
This commit is contained in:
@@ -41,17 +41,6 @@ uint64_t tor_ntohll(uint64_t a);
|
||||
|
||||
void tor_log_mallinfo(int severity);
|
||||
|
||||
/** Macro: yield a pointer to the field at position <b>off</b> within the
|
||||
* structure <b>st</b>. Example:
|
||||
* <pre>
|
||||
* struct a { int foo; int bar; } x;
|
||||
* off_t bar_offset = offsetof(struct a, bar);
|
||||
* int *bar_p = STRUCT_VAR_P(&x, bar_offset);
|
||||
* *bar_p = 3;
|
||||
* </pre>
|
||||
*/
|
||||
#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>
|
||||
|
||||
@@ -242,4 +242,15 @@
|
||||
#error Unknown: SIZEOF_INTPTR_T
|
||||
#endif /* (SIZEOF_INTPTR_T == SIZEOF_INT) || ... */
|
||||
|
||||
/** Macro: yield a pointer to the field at position <b>off</b> within the
|
||||
* structure <b>st</b>. Example:
|
||||
* <pre>
|
||||
* struct a { int foo; int bar; } x;
|
||||
* off_t bar_offset = offsetof(struct a, bar);
|
||||
* int *bar_p = STRUCT_VAR_P(&x, bar_offset);
|
||||
* *bar_p = 3;
|
||||
* </pre>
|
||||
*/
|
||||
#define STRUCT_VAR_P(st, off) ((void*) ( ((char*)(st)) + (off) ) )
|
||||
|
||||
#endif /* !defined(TOR_COMPAT_H) */
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
|
||||
#include "lib/malloc/util_malloc.h"
|
||||
#include "lib/container/smartlist.h"
|
||||
#include "common/util.h"
|
||||
#include "lib/err/torerr.h"
|
||||
#include "common/util.h" // For strstrip.
|
||||
#include "lib/crypt_ops/crypto_digest.h"
|
||||
#include "lib/ctime/di_ops.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user