[tor-commits] [tor/master] compat_compiler: fix documentation for STRUCT_VAR_P

asn at torproject.org asn at torproject.org
Thu Sep 5 14:09:38 UTC 2019


commit b39ee42904d9210ff3b6872d69535d32f588f907
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Sep 4 10:56:57 2019 -0400

    compat_compiler: fix documentation for STRUCT_VAR_P
    
    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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/cc/compat_compiler.h b/src/lib/cc/compat_compiler.h
index a8d159321..92301449e 100644
--- a/src/lib/cc/compat_compiler.h
+++ b/src/lib/cc/compat_compiler.h
@@ -195,7 +195,7 @@
  * 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>





More information about the tor-commits mailing list