diff --git a/src/protocol/protocol.c b/src/protocol/protocol.c index 3206888..271b0c0 100644 --- a/src/protocol/protocol.c +++ b/src/protocol/protocol.c @@ -23,8 +23,6 @@ */ #include #include -#include -#include #include #include #include @@ -32,35 +30,4 @@ #include "criterion/internal/common.h" #include "protocol.h" -static bool write_fd_callback(pb_ostream_t *stream, const uint8_t *buf, size_t count) { - int fd = (intptr_t) stream->state; - ssize_t result = write(fd, buf, count); - - if (result < 0) - return false; - return (size_t) result == count; -} - -static bool read_fd_callback(pb_istream_t *stream, uint8_t *buf, size_t count) { - int fd = (intptr_t) stream->state; - ssize_t result = read(fd, buf, count); - - if (result < 0) - return false; - - if ((size_t) result < count) - stream->bytes_left = result; - return (size_t) result == count; -} - -pb_ostream_t pb_ostream_from_fd(int fd) { - pb_ostream_t stream = {&write_fd_callback, (void*)(intptr_t) fd, SIZE_MAX, 0, NULL}; - return stream; -} - -pb_istream_t pb_istream_from_fd(int fd) { - pb_istream_t stream = {&read_fd_callback, (void*)(intptr_t) fd, SIZE_MAX, NULL}; - return stream; -} - volatile bool is_extern_worker = false; diff --git a/src/protocol/protocol.h b/src/protocol/protocol.h index 4e4db88..60a4616 100644 --- a/src/protocol/protocol.h +++ b/src/protocol/protocol.h @@ -34,12 +34,6 @@ enum protocol_version { PROTOCOL_V1 = 1, }; -bool pb_write_string(pb_ostream_t *stream, const pb_field_t *field, void * const *arg); -bool pb_read_string(pb_istream_t *stream, const pb_field_t *field, void **arg); - -pb_ostream_t pb_ostream_from_fd(int fd); -pb_istream_t pb_istream_from_fd(int fd); - extern volatile bool is_extern_worker; # define criterion_message_set_id(Msg) \