summaryrefslogtreecommitdiff
path: root/src/libwaitress/waitress.c
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2011-09-18 20:18:09 +0200
committerLars-Dominik Braun <lars@6xq.net>2011-11-09 20:10:03 +0100
commit16f6508435773327cc91d08654c32acc14efb850 (patch)
tree677ea6f59aa75fda713e6fdf186d4fed1a7ed2c1 /src/libwaitress/waitress.c
parent4152dd8975b5ab3d7338325b56d2fa975ac0c4aa (diff)
downloadpianobar-16f6508435773327cc91d08654c32acc14efb850.tar.gz
pianobar-16f6508435773327cc91d08654c32acc14efb850.tar.bz2
pianobar-16f6508435773327cc91d08654c32acc14efb850.zip
waitress: move macro def into function
Diffstat (limited to 'src/libwaitress/waitress.c')
-rw-r--r--src/libwaitress/waitress.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/libwaitress/waitress.c b/src/libwaitress/waitress.c
index c360433..baf1ae4 100644
--- a/src/libwaitress/waitress.c
+++ b/src/libwaitress/waitress.c
@@ -458,19 +458,6 @@ static WaitressReturn_t WaitressPollRead (int sockfd, char *buf, size_t count,
return WAITRESS_RET_OK;
}
-/* FIXME: compiler macros are ugly... */
-#define FINISH(ret) wRet = ret; goto finish;
-#define WRITE_RET(buf, count) \
- if ((wRet = WaitressPollWrite (sockfd, buf, count, \
- &sockpoll, waith->socktimeout)) != WAITRESS_RET_OK) { \
- FINISH (wRet); \
- }
-#define READ_RET(buf, count, size) \
- if ((wRet = WaitressPollRead (sockfd, buf, count, \
- &sockpoll, waith->socktimeout, size)) != WAITRESS_RET_OK) { \
- FINISH (wRet); \
- }
-
/* send basic http authorization
* @param waitress handle
* @param url containing user/password
@@ -531,6 +518,19 @@ static int WaitressParseStatusline (const char * const line) {
* @return WaitressReturn_t
*/
WaitressReturn_t WaitressFetchCall (WaitressHandle_t *waith) {
+/* FIXME: compiler macros are ugly... */
+#define FINISH(ret) wRet = ret; goto finish;
+#define WRITE_RET(buf, count) \
+ if ((wRet = WaitressPollWrite (sockfd, buf, count, \
+ &sockpoll, waith->socktimeout)) != WAITRESS_RET_OK) { \
+ FINISH (wRet); \
+ }
+#define READ_RET(buf, count, size) \
+ if ((wRet = WaitressPollRead (sockfd, buf, count, \
+ &sockpoll, waith->socktimeout, size)) != WAITRESS_RET_OK) { \
+ FINISH (wRet); \
+ }
+
struct addrinfo hints, *res;
int sockfd;
char *buf = NULL;
@@ -757,11 +757,11 @@ finish:
return WAITRESS_RET_PARTIAL_FILE;
}
return wRet;
-}
-#undef CLOSE_RET
+#undef FINISH
#undef WRITE_RET
#undef READ_RET
+}
const char *WaitressErrorToStr (WaitressReturn_t wRet) {
switch (wRet) {