diff --git a/src/Util.c b/src/Util.c index b32e18b..8435a91 100644 --- a/src/Util.c +++ b/src/Util.c @@ -301,37 +301,3 @@ UtilGetLine(char **linePtr, size_t * n, Stream * stream) return UtilGetDelim(linePtr, n, '\n', stream); } -size_t -UtilStreamCopy(Stream * in, Stream * out) -{ - size_t bytes = 0; - int c; - - while (1) - { - c = StreamGetc(in); - - if (StreamEof(in)) - { - break; - } - - if (StreamError(in)) - { - if (errno == EAGAIN) - { - StreamClearError(in); - continue; - } - else - { - break; - } - } - - StreamPutc(out, c); - bytes++; - } - - return bytes; -} diff --git a/src/include/Util.h b/src/include/Util.h index 2e2a692..d3036db 100644 --- a/src/include/Util.h +++ b/src/include/Util.h @@ -52,7 +52,4 @@ extern ssize_t extern ssize_t UtilGetLine(char **, size_t *, Stream *); -extern size_t - UtilStreamCopy(Stream *, Stream *); - #endif /* TELODENDRIA_UTIL_H */ diff --git a/tools/src/http-debug-server.c b/tools/src/http-debug-server.c index cbffa09..7fc0741 100644 --- a/tools/src/http-debug-server.c +++ b/tools/src/http-debug-server.c @@ -59,7 +59,7 @@ HttpHandle(HttpServerContext * cx, void *args) StreamPutc(StreamStdout(), '\n'); - bytes = UtilStreamCopy(HttpServerStream(cx), StreamStdout()); + bytes = StreamCopy(HttpServerStream(cx), StreamStdout()); StreamPutc(StreamStdout(), '\n'); StreamPrintf(StreamStdout(), "(%lu bytes)\n", bytes); diff --git a/tools/src/http.c b/tools/src/http.c index b12b8fe..b42fd58 100644 --- a/tools/src/http.c +++ b/tools/src/http.c @@ -33,7 +33,6 @@ #include #include #include -#include #define FLAG_HEADERS (1 << 0) @@ -182,7 +181,7 @@ main(int argc, char **argv) return 1; } - UtilStreamCopy(in, HttpClientStream(cx)); + StreamCopy(in, HttpClientStream(cx)); StreamClose(in); } @@ -216,7 +215,7 @@ main(int argc, char **argv) StreamPutc(StreamStdout(), '\n'); } - UtilStreamCopy(HttpClientStream(cx), StreamStdout()); + StreamCopy(HttpClientStream(cx), StreamStdout()); HttpClientContextFree(cx); UriFree(uri);