summaryrefslogtreecommitdiff
path: root/src/feature
diff options
context:
space:
mode:
authorTaylor Yu <catalyst@torproject.org>2019-06-25 09:54:50 -0500
committerTaylor Yu <catalyst@torproject.org>2019-06-25 11:40:44 -0500
commite5e6953be74ab5d09608dcf6af48caae4e57464c (patch)
treef231d4ab986e990122c3e8f7d2c47bd88a7a6850 /src/feature
parent0dd59fdb56c9a47a018856b689eaa3c6775ed3d4 (diff)
downloadtor-e5e6953be74ab5d09608dcf6af48caae4e57464c.tar.gz
tor-e5e6953be74ab5d09608dcf6af48caae4e57464c.zip
Make control_write_reply() mockable
Part of ticket 30889.
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/control/control_proto.c5
-rw-r--r--src/feature/control/control_proto.h4
2 files changed, 5 insertions, 4 deletions
diff --git a/src/feature/control/control_proto.c b/src/feature/control/control_proto.c
index 1dd62da2be..d2541e7308 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 101b808d88..3182f3d415 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);