diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2011-09-18 20:18:09 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2011-11-09 20:10:03 +0100 |
commit | 16f6508435773327cc91d08654c32acc14efb850 (patch) | |
tree | 677ea6f59aa75fda713e6fdf186d4fed1a7ed2c1 /src/libwaitress/waitress.c | |
parent | 4152dd8975b5ab3d7338325b56d2fa975ac0c4aa (diff) | |
download | pianobar-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.c | 30 |
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) { |