Revise struct names in examples in comments to end with _t

This commit is contained in:
Nick Mathewson 2019-11-16 15:12:35 -05:00
parent c9b2fe0460
commit 5a1a60e65e
3 changed files with 17 additions and 17 deletions

View file

@ -194,8 +194,8 @@
/** Macro: yield a pointer to the field at position <b>off</b> within the /** Macro: yield a pointer to the field at position <b>off</b> within the
* structure <b>st</b>. Example: * structure <b>st</b>. Example:
* <pre> * <pre>
* struct a { int foo; int bar; } x; * struct a_t { int foo; int bar; } x;
* ptrdiff_t bar_offset = offsetof(struct a, bar); * ptrdiff_t bar_offset = offsetof(struct a_t, bar);
* int *bar_p = STRUCT_VAR_P(&x, bar_offset); * int *bar_p = STRUCT_VAR_P(&x, bar_offset);
* *bar_p = 3; * *bar_p = 3;
* </pre> * </pre>
@ -205,10 +205,10 @@
/** Macro: yield a pointer to an enclosing structure given a pointer to /** Macro: yield a pointer to an enclosing structure given a pointer to
* a substructure at offset <b>off</b>. Example: * a substructure at offset <b>off</b>. Example:
* <pre> * <pre>
* struct base { ... }; * struct base_t { ... };
* struct subtype { int x; struct base b; } x; * struct subtype_t { int x; struct base_t b; } x;
* struct base *bp = &x.base; * struct base_t *bp = &x.base;
* struct *sp = SUBTYPE_P(bp, struct subtype, b); * struct *sp = SUBTYPE_P(bp, struct subtype_t, b);
* </pre> * </pre>
*/ */
#define SUBTYPE_P(p, subtype, basemember) \ #define SUBTYPE_P(p, subtype, basemember) \

View file

@ -16,33 +16,33 @@
* To enable a type to have handles, add a HANDLE_ENTRY() field in its * To enable a type to have handles, add a HANDLE_ENTRY() field in its
* definition, as in: * definition, as in:
* *
* struct walrus { * struct walrus_t {
* HANDLE_ENTRY(wlr, walrus); * 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): * manipulation functions (typically in a header):
* *
* // opaque handle to walrus. * // opaque handle to walrus.
* typedef struct wlr_handle_t wlr_handle_t; * typedef struct wlr_handle_t wlr_handle_t;
* *
* // make a new handle * // 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 * // release a handle
* void wlr_handle_free(wlr_handle_t *); * void wlr_handle_free(wlr_handle_t *);
* *
* // return the pointed-to walrus, or NULL. * // 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; * // call this function when you're about to free the walrus;
* // it invalidates all handles. (IF YOU DON'T, YOU WILL HAVE * // it invalidates all handles. (IF YOU DON'T, YOU WILL HAVE
* // DANGLING REFERENCES) * // 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 * 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])
* *
**/ **/

View file

@ -75,7 +75,7 @@ struct dist_t {
* If you want to define a distribution type, define a canonical set of * If you want to define a distribution type, define a canonical set of
* operations and define a type-specific initializer element like so: * operations and define a type-specific initializer element like so:
* *
* struct foo { * struct foo_t {
* struct dist_t base; * struct dist_t base;
* int omega; * int omega;
* double tau; * double tau;
@ -84,11 +84,11 @@ struct dist_t {
* *
* struct dist_ops_t foo_ops = ...; * 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: * Then users can do:
* *
* struct foo mydist = { * struct foo_t mydist = {
* FOO(mydist), * FOO(mydist),
* .omega = ..., * .omega = ...,
* .tau = ..., * .tau = ...,
@ -97,7 +97,7 @@ struct dist_t {
* *
* If you accidentally write * If you accidentally write
* *
* struct bar mydist = { * struct bar_t mydist = {
* FOO(mydist), * FOO(mydist),
* ... * ...
* }; * };