mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Rename DISPATCH_DEFINE_TYPE() to DISPATCH_REGISTER_TYPE()
Also fix a grammar error in a comment.
This commit is contained in:
@@ -208,16 +208,16 @@ pubsub_add_sub_(pubsub_connector_t *con,
|
||||
}
|
||||
|
||||
/**
|
||||
* Use <b>con</b> to define a the functions to use for manipulating the type
|
||||
* Use <b>con</b> to define the functions to use for manipulating the type
|
||||
* <b>type</b>. Any function pointers left as NULL will be implemented as
|
||||
* no-ops.
|
||||
**/
|
||||
int
|
||||
pubsub_connector_define_type_(pubsub_connector_t *con,
|
||||
msg_type_id_t type,
|
||||
dispatch_typefns_t *fns,
|
||||
const char *file,
|
||||
unsigned line)
|
||||
pubsub_connector_register_type_(pubsub_connector_t *con,
|
||||
msg_type_id_t type,
|
||||
dispatch_typefns_t *fns,
|
||||
const char *file,
|
||||
unsigned line)
|
||||
{
|
||||
pubsub_type_cfg_t *cfg = tor_malloc_zero(sizeof(*cfg));
|
||||
cfg->type = type;
|
||||
|
||||
@@ -45,10 +45,10 @@ int pubsub_add_sub_(struct pubsub_connector_t *con,
|
||||
const char *file,
|
||||
unsigned line);
|
||||
|
||||
int pubsub_connector_define_type_(struct pubsub_connector_t *,
|
||||
msg_type_id_t,
|
||||
dispatch_typefns_t *,
|
||||
const char *file,
|
||||
unsigned line);
|
||||
int pubsub_connector_register_type_(struct pubsub_connector_t *,
|
||||
msg_type_id_t,
|
||||
dispatch_typefns_t *,
|
||||
const char *file,
|
||||
unsigned line);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
* }
|
||||
*
|
||||
* Where did these types come from? Somewhere in the code, you need to call
|
||||
* DISPATCH_DEFINE_TYPE() to make sure that the dispatcher can manage the
|
||||
* DISPATCH_REGISTER_TYPE() to make sure that the dispatcher can manage the
|
||||
* message auxiliary data. It associates a vtbl-like structure with the
|
||||
* type name, so that the dispatcher knows how to manipulate the type you're
|
||||
* giving it.
|
||||
@@ -100,7 +100,7 @@
|
||||
* .fmt_fn = boolean_fmt,
|
||||
* .free_fn = boolean_free,
|
||||
* };
|
||||
* DISPATCH_DEFINE_TYPE(con, boolean, &boolean_fns);
|
||||
* DISPATCH_REGISTER_TYPE(con, boolean, &boolean_fns);
|
||||
* }
|
||||
*
|
||||
*
|
||||
@@ -184,7 +184,7 @@
|
||||
*
|
||||
* "typename" is a unique identifier for the type of the auxiliary data.
|
||||
* It needs to be defined somewhere in Tor, using
|
||||
* "DISPATCH_DEFINE_TYPE."
|
||||
* "DISPATCH_REGISTER_TYPE."
|
||||
*
|
||||
* "c_type" is a C pointer type (like "char *" or "struct foo *").
|
||||
*/
|
||||
@@ -210,7 +210,7 @@
|
||||
* C identifier.
|
||||
*
|
||||
* "typename" is a unique identifier for the type of the auxiliary data. It
|
||||
* needs to be defined somewhere in Tor, using "DISPATCH_DEFINE_TYPE."
|
||||
* needs to be defined somewhere in Tor, using "DISPATCH_REGISTER_TYPE."
|
||||
*
|
||||
* "c_type" is a C integer type, like "int" or "bool". It needs to fit inside
|
||||
* a uint64_t.
|
||||
@@ -362,8 +362,8 @@
|
||||
* Use a given connector to declare that the functions to be used to manipuate
|
||||
* a certain C type.
|
||||
**/
|
||||
#define DISPATCH_DEFINE_TYPE(con, type, fns) \
|
||||
pubsub_connector_define_type_((con), \
|
||||
#define DISPATCH_REGISTER_TYPE(con, type, fns) \
|
||||
pubsub_connector_register_type_((con), \
|
||||
get_msg_type_id(#type), \
|
||||
(fns), \
|
||||
__FILE__, \
|
||||
|
||||
@@ -86,7 +86,7 @@ seed_dispatch_builder(pubsub_builder_t *b,
|
||||
|
||||
{
|
||||
c = pubsub_connector_for_subsystem(b, get_subsys_id("sys1"));
|
||||
DISPATCH_DEFINE_TYPE(c, int, &intfns);
|
||||
DISPATCH_REGISTER_TYPE(c, int, &intfns);
|
||||
if (fl1 != FLAG_SKIP)
|
||||
DISPATCH_ADD_PUB_(c, main, bunch_of_coconuts, fl1);
|
||||
if (fl2 != FLAG_SKIP)
|
||||
@@ -96,7 +96,7 @@ seed_dispatch_builder(pubsub_builder_t *b,
|
||||
|
||||
{
|
||||
c = pubsub_connector_for_subsystem(b, get_subsys_id("sys2"));
|
||||
DISPATCH_DEFINE_TYPE(c, string, &stringfns);
|
||||
DISPATCH_REGISTER_TYPE(c, string, &stringfns);
|
||||
if (fl3 != FLAG_SKIP)
|
||||
DISPATCH_ADD_PUB_(c, main, yes_we_have_no, fl3);
|
||||
if (fl4 != FLAG_SKIP)
|
||||
@@ -178,7 +178,7 @@ test_pubsub_build_types_decls_conflict(void *arg)
|
||||
{
|
||||
c = pubsub_connector_for_subsystem(b, get_subsys_id("sys3"));
|
||||
// Extra declaration of int: we don't allow this.
|
||||
DISPATCH_DEFINE_TYPE(c, int, &stringfns);
|
||||
DISPATCH_REGISTER_TYPE(c, int, &stringfns);
|
||||
pubsub_connector_free(c);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ setup_dispatcher(const struct testcase_t *testcase)
|
||||
|
||||
{
|
||||
con = pubsub_connector_for_subsystem(builder, get_subsys_id("types"));
|
||||
pubsub_connector_define_type_(con,
|
||||
pubsub_connector_register_type_(con,
|
||||
get_msg_type_id("string"),
|
||||
&stringfns,
|
||||
"nowhere.c", 99);
|
||||
|
||||
Reference in New Issue
Block a user