[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Revise struct names in examples in comments to end with _t



commit 5a1a60e65eb6904f383d18fae271684b4264acd9
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Sat Nov 16 15:12:35 2019 -0500

    Revise struct names in examples in comments to end with _t
---
 src/lib/cc/compat_compiler.h | 12 ++++++------
 src/lib/container/handles.h  | 14 +++++++-------
 src/lib/math/prob_distr.h    |  8 ++++----
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/lib/cc/compat_compiler.h b/src/lib/cc/compat_compiler.h
index 3ef866ecc..9e7436ca1 100644
--- a/src/lib/cc/compat_compiler.h
+++ b/src/lib/cc/compat_compiler.h
@@ -194,8 +194,8 @@
 /** 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;
- *   ptrdiff_t bar_offset = offsetof(struct a, bar);
+ *   struct a_t { int foo; int bar; } x;
+ *   ptrdiff_t bar_offset = offsetof(struct a_t, bar);
  *   int *bar_p = STRUCT_VAR_P(&x, bar_offset);
  *   *bar_p = 3;
  * </pre>
@@ -205,10 +205,10 @@
 /** 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);
+ *   struct base_t { ... };
+ *   struct subtype_t { int x; struct base_t b; } x;
+ *   struct base_t *bp = &x.base;
+ *   struct *sp = SUBTYPE_P(bp, struct subtype_t, b);
  * </pre>
  */
 #define SUBTYPE_P(p, subtype, basemember) \
diff --git a/src/lib/container/handles.h b/src/lib/container/handles.h
index ca7c94559..b6dcadb6b 100644
--- a/src/lib/container/handles.h
+++ b/src/lib/container/handles.h
@@ -16,33 +16,33 @@
  * To enable a type to have handles, add a HANDLE_ENTRY() field in its
  * definition, as in:
  *
- *     struct walrus {
- *         HANDLE_ENTRY(wlr, walrus);
+ *     struct walrus_t {
+ *         HANDLE_ENTRY(wlr, walrus_t);
  *         // ...
  *     };
  *
- * And invoke HANDLE_DECL(wlr, walrus, [static]) to declare the handle
+ * And invoke HANDLE_DECL(wlr, walrus_t, [static]) to declare the handle
  * manipulation functions (typically in a header):
  *
  *     // opaque handle to walrus.
  *     typedef struct wlr_handle_t wlr_handle_t;
  *
  *     // make a new handle
- *     struct wlr_handle_t *wlr_handle_new(struct walrus *);
+ *     struct wlr_handle_t *wlr_handle_new(struct walrus_t *);
  *
  *     // release a handle
  *     void wlr_handle_free(wlr_handle_t *);
  *
  *     // return the pointed-to walrus, or NULL.
- *     struct walrus *wlr_handle_get(wlr_handle_t *).
+ *     struct walrus_t *wlr_handle_get(wlr_handle_t *).
  *
  *     // call this function when you're about to free the walrus;
  *     // it invalidates all handles. (IF YOU DON'T, YOU WILL HAVE
  *     // DANGLING REFERENCES)
- *     void wlr_handles_clear(struct walrus *);
+ *     void wlr_handles_clear(struct walrus_t *);
  *
  * Finally, use HANDLE_IMPL() to define the above functions in some
- * appropriate C file: HANDLE_IMPL(wlr, walrus, [static])
+ * appropriate C file: HANDLE_IMPL(wlr, walrus_t, [static])
  *
  **/
 
diff --git a/src/lib/math/prob_distr.h b/src/lib/math/prob_distr.h
index 4498b0a8b..a036073b9 100644
--- a/src/lib/math/prob_distr.h
+++ b/src/lib/math/prob_distr.h
@@ -75,7 +75,7 @@ struct dist_t {
 * If you want to define a distribution type, define a canonical set of
 * operations and define a type-specific initializer element like so:
 *
-*     struct foo {
+*     struct foo_t {
 *       struct dist_t base;
 *       int omega;
 *       double tau;
@@ -84,11 +84,11 @@ struct dist_t {
 *
 *     struct dist_ops_t foo_ops = ...;
 *
-*     #define FOO(OBJ) DIST_BASE_TYPED(&foo_ops, OBJ, struct foo)
+*     #define FOO(OBJ) DIST_BASE_TYPED(&foo_ops, OBJ, struct foo_t)
 *
 * Then users can do:
 *
-*     struct foo mydist = {
+*     struct foo_t mydist = {
 *       FOO(mydist),
 *       .omega = ...,
 *       .tau = ...,
@@ -97,7 +97,7 @@ struct dist_t {
 *
 * If you accidentally write
 *
-*     struct bar mydist = {
+*     struct bar_t mydist = {
 *       FOO(mydist),
 *       ...
 *     };



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits