forked from lda/telodendria
Remove UtilStreamCopy()
This commit is contained in:
parent
f341fd2b6e
commit
7b3d537175
4 changed files with 3 additions and 41 deletions
34
src/Util.c
34
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;
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <HashMap.h>
|
||||
#include <HttpClient.h>
|
||||
#include <Uri.h>
|
||||
#include <Util.h>
|
||||
|
||||
#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);
|
||||
|
|
Loading…
Reference in a new issue