]> code.delx.au - pulseaudio/blobdiff - src/pulse/mainloop.c
add i18n support
[pulseaudio] / src / pulse / mainloop.c
index fc373d978453d03ab93c2e53854393d1da72aa71..5823e280cf7706210504e1a322d06b5b077391ab 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /***
   This file is part of PulseAudio.
 
@@ -34,8 +32,8 @@
 #include <fcntl.h>
 #include <errno.h>
 
-#ifdef HAVE_SYS_POLL_H
-#include <sys/poll.h>
+#ifdef HAVE_POLL_H
+#include <poll.h>
 #else
 #include <pulsecore/poll.h>
 #endif
@@ -46,6 +44,7 @@
 
 #include <pulse/timeval.h>
 #include <pulse/xmalloc.h>
+#include <pulse/i18n.h>
 
 #include <pulsecore/core-util.h>
 #include <pulsecore/llist.h>
@@ -194,7 +193,7 @@ static pa_io_event* mainloop_io_new(
         if ((select((SELECT_TYPE_ARG1) fd, NULL, NULL, SELECT_TYPE_ARG234 &xset,
                     SELECT_TYPE_ARG5 &tv) == -1) &&
              (WSAGetLastError() == WSAENOTSOCK)) {
-            pa_log_warn("WARNING: cannot monitor non-socket file descriptors.");
+            pa_log_warn("Cannot monitor non-socket file descriptors.");
             e->dead = 1;
         }
     }
@@ -448,6 +447,8 @@ static const pa_mainloop_api vtable = {
 pa_mainloop *pa_mainloop_new(void) {
     pa_mainloop *m;
 
+    pa_init_i18n();
+
     m = pa_xnew(pa_mainloop, 1);
 
     m->wakeup_pipe_type = 0;
@@ -457,10 +458,10 @@ pa_mainloop *pa_mainloop_new(void) {
         return NULL;
     }
 
-    pa_make_nonblock_fd(m->wakeup_pipe[0]);
-    pa_make_nonblock_fd(m->wakeup_pipe[1]);
-    pa_fd_set_cloexec(m->wakeup_pipe[0], 1);
-    pa_fd_set_cloexec(m->wakeup_pipe[1], 1);
+    pa_make_fd_nonblock(m->wakeup_pipe[0]);
+    pa_make_fd_nonblock(m->wakeup_pipe[1]);
+    pa_make_fd_cloexec(m->wakeup_pipe[0]);
+    pa_make_fd_cloexec(m->wakeup_pipe[1]);
     m->wakeup_requested = 0;
 
     PA_LLIST_HEAD_INIT(pa_io_event, m->io_events);
@@ -605,10 +606,7 @@ void pa_mainloop_free(pa_mainloop* m) {
 
     pa_xfree(m->pollfds);
 
-    if (m->wakeup_pipe[0] >= 0)
-        pa_assert_se(pa_close(m->wakeup_pipe[0]) == 0);
-    if (m->wakeup_pipe[1] >= 0)
-        pa_assert_se(pa_close(m->wakeup_pipe[1]) == 0);
+    pa_close_pipe(m->wakeup_pipe);
 
     pa_xfree(m);
 }