rewrite

    int err;
    err = poll_sndio();
    if (err < 0) {
        :

to

    if (poll_sndio() < 0) {
        :
This commit is contained in:
SASANO Takayoshi 2021-02-26 06:57:59 +09:00
parent c18b562409
commit 0c285a0c6d
1 changed files with 3 additions and 7 deletions

View File

@ -1000,8 +1000,6 @@ int audio_get (int a)
int n; int n;
#if USE_ALSA #if USE_ALSA
int retries = 0; int retries = 0;
#elif USE_SNDIO
int err;
#endif #endif
#if STATISTICS #if STATISTICS
@ -1135,8 +1133,7 @@ int audio_get (int a)
while (adev[a].inbuf_next >= adev[a].inbuf_len) { while (adev[a].inbuf_next >= adev[a].inbuf_len) {
assert (adev[a].sndio_in_handle != NULL); assert (adev[a].sndio_in_handle != NULL);
err = poll_sndio (adev[a].sndio_in_handle, POLLIN); if (poll_sndio (adev[a].sndio_in_handle, POLLIN) < 0) {
if (err < 0) {
adev[a].inbuf_len = 0; adev[a].inbuf_len = 0;
adev[a].inbuf_next = 0; adev[a].inbuf_next = 0;
return (-1); return (-1);
@ -1436,15 +1433,14 @@ int audio_flush (int a)
int k; int k;
unsigned char *ptr; unsigned char *ptr;
int len, err; int len;
ptr = adev[a].outbuf_ptr; ptr = adev[a].outbuf_ptr;
len = adev[a].outbuf_len; len = adev[a].outbuf_len;
while (len > 0) { while (len > 0) {
assert (adev[a].sndio_out_handle != NULL); assert (adev[a].sndio_out_handle != NULL);
err = poll_sndio (adev[a].sndio_out_handle, POLLOUT); if (poll_sndio (adev[a].sndio_out_handle, POLLOUT) < 0) {
if (err < 0) {
text_color_set(DW_COLOR_ERROR); text_color_set(DW_COLOR_ERROR);
perror("Can't write to audio device"); perror("Can't write to audio device");
adev[a].outbuf_len = 0; adev[a].outbuf_len = 0;