[tor-commits] [tor/master] Rename DISPATCH_DEFINE_TYPE() to DISPATCH_REGISTER_TYPE()
asn at torproject.org
asn at torproject.org
Wed Mar 27 12:31:32 UTC 2019
commit 3f0bfe1d29e571f1450286085e62246b01509b3b
Author: Nick Mathewson <nickm at torproject.org>
Date: Thu Mar 14 15:39:14 2019 -0400
Rename DISPATCH_DEFINE_TYPE() to DISPATCH_REGISTER_TYPE()
Also fix a grammar error in a comment.
---
src/lib/pubsub/pubsub_build.c | 12 ++++++------
src/lib/pubsub/pubsub_connect.h | 10 +++++-----
src/lib/pubsub/pubsub_macros.h | 12 ++++++------
src/test/test_pubsub_build.c | 6 +++---
src/test/test_pubsub_msg.c | 2 +-
5 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/src/lib/pubsub/pubsub_build.c b/src/lib/pubsub/pubsub_build.c
index 1dc20f51f..e44b7d76e 100644
--- a/src/lib/pubsub/pubsub_build.c
+++ b/src/lib/pubsub/pubsub_build.c
@@ -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;
diff --git a/src/lib/pubsub/pubsub_connect.h b/src/lib/pubsub/pubsub_connect.h
index e4d860005..bdcb33d2f 100644
--- a/src/lib/pubsub/pubsub_connect.h
+++ b/src/lib/pubsub/pubsub_connect.h
@@ -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
diff --git a/src/lib/pubsub/pubsub_macros.h b/src/lib/pubsub/pubsub_macros.h
index 11c7c63ec..f0429dbde 100644
--- a/src/lib/pubsub/pubsub_macros.h
+++ b/src/lib/pubsub/pubsub_macros.h
@@ -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__, \
diff --git a/src/test/test_pubsub_build.c b/src/test/test_pubsub_build.c
index f6c6b81a2..9ffe428c0 100644
--- a/src/test/test_pubsub_build.c
+++ b/src/test/test_pubsub_build.c
@@ -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);
}
diff --git a/src/test/test_pubsub_msg.c b/src/test/test_pubsub_msg.c
index 41a8a25ad..73c7c9f54 100644
--- a/src/test/test_pubsub_msg.c
+++ b/src/test/test_pubsub_msg.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);
More information about the tor-commits
mailing list