commit bfe38878b28a90fb80d9e6311d28dcabd978b1ba Author: Taylor Yu catalyst@torproject.org Date: Sun Dec 8 22:20:16 2019 -0600
Rename control_reply_add_1kv
Part of ticket 30984. --- src/feature/control/control_cmd.c | 6 +++--- src/feature/control/control_getinfo.c | 2 +- src/feature/control/control_proto.c | 6 +++--- src/feature/control/control_proto.h | 6 +++--- src/test/test_controller.c | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/feature/control/control_cmd.c b/src/feature/control/control_cmd.c index ce7d1ad2c..cc4375112 100644 --- a/src/feature/control/control_cmd.c +++ b/src/feature/control/control_cmd.c @@ -299,13 +299,13 @@ handle_control_getconf(control_connection_t *conn, config_line_t *answer = option_get_assignment(options,q); if (!answer) { const char *name = option_get_canonical_name(q); - control_reply_add_1kv(answers, 250, KV_OMIT_VALS, name, ""); + control_reply_add_one_kv(answers, 250, KV_OMIT_VALS, name, ""); }
while (answer) { config_line_t *next; - control_reply_add_1kv(answers, 250, KV_RAW, answer->key, - answer->value); + control_reply_add_one_kv(answers, 250, KV_RAW, answer->key, + answer->value); next = answer->next; tor_free(answer->key); tor_free(answer->value); diff --git a/src/feature/control/control_getinfo.c b/src/feature/control/control_getinfo.c index 20dc4d082..cff4a0879 100644 --- a/src/feature/control/control_getinfo.c +++ b/src/feature/control/control_getinfo.c @@ -1653,7 +1653,7 @@ handle_control_getinfo(control_connection_t *conn, "Unrecognized key "%s"", q); } } else { - control_reply_add_1kv(answers, 250, KV_RAW, q, ans); + control_reply_add_one_kv(answers, 250, KV_RAW, q, ans); } } SMARTLIST_FOREACH_END(q);
diff --git a/src/feature/control/control_proto.c b/src/feature/control/control_proto.c index 4efe735c7..7d04fea6a 100644 --- a/src/feature/control/control_proto.c +++ b/src/feature/control/control_proto.c @@ -335,8 +335,8 @@ control_write_reply_lines(control_connection_t *conn, smartlist_t *lines) * @param val value */ void -control_reply_add_1kv(smartlist_t *reply, int code, int flags, - const char *key, const char *val) +control_reply_add_one_kv(smartlist_t *reply, int code, int flags, + const char *key, const char *val) { control_reply_line_t *line = tor_malloc_zero(sizeof(*line));
@@ -374,7 +374,7 @@ control_reply_append_kv(smartlist_t *reply, const char *key, const char *val) void control_reply_add_str(smartlist_t *reply, int code, const char *s) { - control_reply_add_1kv(reply, code, KV_OMIT_KEYS|KV_RAW, "", s); + control_reply_add_one_kv(reply, code, KV_OMIT_KEYS|KV_RAW, "", s); }
/** Format a new reply line diff --git a/src/feature/control/control_proto.h b/src/feature/control/control_proto.h index 65c81924f..cf7c00043 100644 --- a/src/feature/control/control_proto.h +++ b/src/feature/control/control_proto.h @@ -29,7 +29,7 @@ * Generally, modules implementing control commands will work with * smartlists of these structures, using functions like * control_reply_add_str() for adding a reply line consisting of a - * single string, or control_reply_add_1kv() and + * single string, or control_reply_add_one_kv() and * control_reply_append_kv() for composing a line containing one or * more key-value pairs. * @@ -97,8 +97,8 @@ void control_write_reply_line(control_connection_t *conn, const control_reply_line_t *line, bool lastone); void control_write_reply_lines(control_connection_t *conn, smartlist_t *lines);
-void control_reply_add_1kv(smartlist_t *reply, int code, int flags, - const char *key, const char *val); +void control_reply_add_one_kv(smartlist_t *reply, int code, int flags, + const char *key, const char *val); void control_reply_append_kv(smartlist_t *reply, const char *key, const char *val); void control_reply_add_str(smartlist_t *reply, int code, const char *s); diff --git a/src/test/test_controller.c b/src/test/test_controller.c index eb68e4847..b3023130a 100644 --- a/src/test/test_controller.c +++ b/src/test/test_controller.c @@ -1993,8 +1993,8 @@ test_control_reply(void *arg) UNMOCK(control_write_reply); MOCK(control_write_reply, mock_control_write_reply_list); reply_strs = smartlist_new(); - control_reply_add_1kv(lines, 250, 0, "A", "B"); - control_reply_add_1kv(lines, 250, 0, "C", "D"); + control_reply_add_one_kv(lines, 250, 0, "A", "B"); + control_reply_add_one_kv(lines, 250, 0, "C", "D"); control_write_reply_lines(NULL, lines); tt_int_op(smartlist_len(reply_strs), OP_EQ, 2); tt_str_op((char *)smartlist_get(reply_strs, 0), OP_EQ, "250-A=B"); @@ -2004,7 +2004,7 @@ test_control_reply(void *arg) SMARTLIST_FOREACH(reply_strs, char *, p, tor_free(p)); smartlist_clear(reply_strs); control_reply_add_printf(lines, 250, "PROTOCOLINFO %d", 1); - control_reply_add_1kv(lines, 250, KV_OMIT_VALS|KV_RAW, "AUTH", ""); + control_reply_add_one_kv(lines, 250, KV_OMIT_VALS|KV_RAW, "AUTH", ""); control_reply_append_kv(lines, "METHODS", "COOKIE"); control_reply_append_kv(lines, "COOKIEFILE", escaped("/tmp/cookie")); control_reply_add_done(lines);
tor-commits@lists.torproject.org