commit e5e6953be74ab5d09608dcf6af48caae4e57464c Author: Taylor Yu catalyst@torproject.org Date: Tue Jun 25 09:54:50 2019 -0500
Make control_write_reply() mockable
Part of ticket 30889. --- src/feature/control/control_proto.c | 5 +++-- src/feature/control/control_proto.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/feature/control/control_proto.c b/src/feature/control/control_proto.c index 1dd62da2b..d2541e730 100644 --- a/src/feature/control/control_proto.c +++ b/src/feature/control/control_proto.c @@ -176,8 +176,9 @@ send_control_done(control_connection_t *conn) * @param c separator character, usually ' ', '-', or '+' * @param s string */ -void -control_write_reply(control_connection_t *conn, int code, int c, const char *s) +MOCK_IMPL(void, +control_write_reply, (control_connection_t *conn, int code, int c, + const char *s)) { connection_printf_to_buf(conn, "%03d%c%s\r\n", code, c, s); } diff --git a/src/feature/control/control_proto.h b/src/feature/control/control_proto.h index 101b808d8..3182f3d41 100644 --- a/src/feature/control/control_proto.h +++ b/src/feature/control/control_proto.h @@ -21,8 +21,8 @@ size_t write_escaped_data(const char *data, size_t len, char **out); size_t read_escaped_data(const char *data, size_t len, char **out); void send_control_done(control_connection_t *conn);
-void control_write_reply(control_connection_t *conn, int code, int c, - const char *s); +MOCK_DECL(void, control_write_reply, (control_connection_t *conn, int code, + int c, const char *s)); void control_vprintf_reply(control_connection_t *conn, int code, int c, const char *fmt, va_list ap) CHECK_PRINTF(4, 0);