summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2011-11-13 17:10:56 +0100
committerLars-Dominik Braun <lars@6xq.net>2011-11-13 17:16:36 +0100
commit19c81bb9fa9209a24ccf3d8c6843cd37a8120a1e (patch)
tree04995264c5c4e45b6dfb9dbfa59482aca273c352
parent28f2ad12316f73eef454fb3cde5ea06a69b9e778 (diff)
downloadpianobar-19c81bb9fa9209a24ccf3d8c6843cd37a8120a1e.tar.gz
pianobar-19c81bb9fa9209a24ccf3d8c6843cd37a8120a1e.tar.bz2
pianobar-19c81bb9fa9209a24ccf3d8c6843cd37a8120a1e.zip
waitress: Move READ/WRITE_RET to the top
-rw-r--r--src/libwaitress/waitress.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/libwaitress/waitress.c b/src/libwaitress/waitress.c
index 498576d..a43c81e 100644
--- a/src/libwaitress/waitress.c
+++ b/src/libwaitress/waitress.c
@@ -55,6 +55,17 @@ typedef struct {
static WaitressReturn_t WaitressReceiveHeaders (WaitressHandle_t *, size_t *);
+#define READ_RET(buf, count, size) \
+ if ((wRet = waith->request.read (waith, buf, count, size)) != \
+ WAITRESS_RET_OK) { \
+ return wRet; \
+ }
+
+#define WRITE_RET(buf, count) \
+ if ((wRet = waith->request.write (waith, buf, count)) != WAITRESS_RET_OK) { \
+ return wRet; \
+ }
+
void WaitressInit (WaitressHandle_t *waith) {
assert (waith != NULL);
@@ -846,11 +857,6 @@ static WaitressReturn_t WaitressConnect (WaitressHandle_t *waith) {
/* Write http header/post data to socket
*/
static WaitressReturn_t WaitressSendRequest (WaitressHandle_t *waith) {
-#define WRITE_RET(buf, count) \
- if ((wRet = waith->request.write (waith, buf, count)) != WAITRESS_RET_OK) { \
- return wRet; \
- }
-
assert (waith != NULL);
assert (waith->request.buf != NULL);
@@ -915,14 +921,8 @@ static WaitressReturn_t WaitressSendRequest (WaitressHandle_t *waith) {
}
return WAITRESS_RET_OK;
-#undef WRITE_RET
}
-#define READ_RET(buf, count, size) \
- if ((wRet = waith->request.read (waith, buf, count, size)) != \
- WAITRESS_RET_OK) { \
- return wRet; \
- }
/* receive response headers
* @param Waitress handle
* @param return unhandled bytes count in buf
@@ -1049,8 +1049,6 @@ static WaitressReturn_t WaitressReceiveResponse (WaitressHandle_t *waith) {
} while (recvSize > 0);
return WAITRESS_RET_OK;
-
-#undef READ_RET
}
/* Receive data from host and call *callback ()