]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
compat_compiler: fix documentation for STRUCT_VAR_P
authorNick Mathewson <nickm@torproject.org>
Wed, 4 Sep 2019 14:56:57 +0000 (10:56 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 4 Sep 2019 16:06:27 +0000 (12:06 -0400)
Previously we had said that off_t was a reasonable type to hold the
result of offsetof().  That isn't so: ptrdiff_t is correct.

src/lib/cc/compat_compiler.h

index a8d1593214ad34bea0bda88d48ee3023f9d1f47d..92301449e8f3f043b5983bc4211e0f0ffa95f532 100644 (file)
  * structure <b>st</b>.  Example:
  * <pre>
  *   struct a { int foo; int bar; } x;
- *   off_t bar_offset = offsetof(struct a, bar);
+ *   ptrdiff_t bar_offset = offsetof(struct a, bar);
  *   int *bar_p = STRUCT_VAR_P(&x, bar_offset);
  *   *bar_p = 3;
  * </pre>