[hackers] [quark] Refactor loop inside writedata() || FRIGN
commit 92b8bc27da21394c78a9cb36cf0c11f7b2a782d8
Author: FRIGN <dev_AT_frign.de>
Date: Thu Aug 7 17:02:03 2014 +0200
Refactor loop inside writedata()
Use for for this stuff.
diff --git a/quark.c b/quark.c
index b15edeb..d819e8d 100644
--- a/quark.c
+++ b/quark.c
_AT_@ -95,14 +95,13 @@ static Request req;
ssize_t
writedata(const char *buf, size_t buf_len) {
- ssize_t r, offset = 0;
+ ssize_t r, offset;
- while(offset < buf_len) {
+ for(offset = 0; offset < buf_len; offset += r) {
if((r = write(req.fd, buf + offset, buf_len - offset)) == -1) {
logerrmsg("client %s closed connection
", host);
return 1;
}
- offset += r;
}
return 0;
}
Received on Thu Aug 07 2014 - 17:01:59 CEST
This archive was generated by hypermail 2.3.0
: Thu Aug 07 2014 - 17:12:09 CEST