[pulseaudio-commits] r1812 - in /branches/lennart/src: daemon/cpulimit.c daemon/main.c pulse/context.c pulse/mainloop-signal.c pulse/mainloop.c pulsecore/core-util.c pulsecore/core-util.h pulsecore/fdsem.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Tue Sep 11 17:17:52 PDT 2007
Author: lennart
Date: Wed Sep 12 02:17:51 2007
New Revision: 1812
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1812&root=pulseaudio&view=rev
Log:
add new pa_pipe_close() API to close two fds at the same time
Modified:
branches/lennart/src/daemon/cpulimit.c
branches/lennart/src/daemon/main.c
branches/lennart/src/pulse/context.c
branches/lennart/src/pulse/mainloop-signal.c
branches/lennart/src/pulse/mainloop.c
branches/lennart/src/pulsecore/core-util.c
branches/lennart/src/pulsecore/core-util.h
branches/lennart/src/pulsecore/fdsem.c
Modified: branches/lennart/src/daemon/cpulimit.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/daemon/cpulimit.c?rev=1812&root=pulseaudio&r1=1811&r2=1812&view=diff
==============================================================================
--- branches/lennart/src/daemon/cpulimit.c (original)
+++ branches/lennart/src/daemon/cpulimit.c Wed Sep 12 02:17:51 2007
@@ -222,11 +222,7 @@
api = NULL;
}
- if (the_pipe[0] >= 0)
- pa_assert_se(pa_close(the_pipe[0]) == 0);
- if (the_pipe[1] >= 0)
- pa_assert_se(pa_close(the_pipe[1]) == 0);
- the_pipe[0] = the_pipe[1] = -1;
+ pa_close_pipe(the_pipe);
if (installed) {
pa_assert_se(sigaction(SIGXCPU, &sigaction_prev, NULL) >= 0);
Modified: branches/lennart/src/daemon/main.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/daemon/main.c?rev=1812&root=pulseaudio&r1=1811&r2=1812&view=diff
==============================================================================
--- branches/lennart/src/daemon/main.c (original)
+++ branches/lennart/src/daemon/main.c Wed Sep 12 02:17:51 2007
@@ -158,14 +158,6 @@
}
}
-static void close_pipe(int p[2]) {
- if (p[0] != -1)
- pa_assert_se(pa_close(p[0]) == 0);
- if (p[1] != -1)
- pa_assert_se(pa_close(p[1]) == 0);
- p[0] = p[1] = -1;
-}
-
#define set_env(key, value) putenv(pa_sprintf_malloc("%s=%s", (key), (value)))
#if defined(HAVE_PWD_H) && defined(HAVE_GRP_H)
@@ -745,7 +737,7 @@
if (valid_pid_file)
pa_pid_file_remove();
- close_pipe(daemon_pipe);
+ pa_close_pipe(daemon_pipe);
#ifdef OS_IS_WIN32
WSACleanup();
Modified: branches/lennart/src/pulse/context.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulse/context.c?rev=1812&root=pulseaudio&r1=1811&r2=1812&view=diff
==============================================================================
--- branches/lennart/src/pulse/context.c (original)
+++ branches/lennart/src/pulse/context.c Wed Sep 12 02:17:51 2007
@@ -585,10 +585,7 @@
return 0;
fail:
- if (fds[0] != -1)
- pa_assert_se(pa_close(fds[0]) == 0);
- if (fds[1] != -1)
- pa_assert_se(pa_close(fds[1]) == 0);
+ pa_close_pipe(fds);
unlock_autospawn_lock_file(c);
Modified: branches/lennart/src/pulse/mainloop-signal.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulse/mainloop-signal.c?rev=1812&root=pulseaudio&r1=1811&r2=1812&view=diff
==============================================================================
--- branches/lennart/src/pulse/mainloop-signal.c (original)
+++ branches/lennart/src/pulse/mainloop-signal.c Wed Sep 12 02:17:51 2007
@@ -147,9 +147,7 @@
api->io_free(io_event);
io_event = NULL;
- pa_assert_se(close(signal_pipe[0]) == 0);
- pa_assert_se(close(signal_pipe[1]) == 0);
- signal_pipe[0] = signal_pipe[1] = -1;
+ pa_close_pipe(signal_pipe);
api = NULL;
}
Modified: branches/lennart/src/pulse/mainloop.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulse/mainloop.c?rev=1812&root=pulseaudio&r1=1811&r2=1812&view=diff
==============================================================================
--- branches/lennart/src/pulse/mainloop.c (original)
+++ branches/lennart/src/pulse/mainloop.c Wed Sep 12 02:17:51 2007
@@ -605,10 +605,7 @@
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);
}
Modified: branches/lennart/src/pulsecore/core-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/core-util.c?rev=1812&root=pulseaudio&r1=1811&r2=1812&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/core-util.c (original)
+++ branches/lennart/src/pulsecore/core-util.c Wed Sep 12 02:17:51 2007
@@ -1323,3 +1323,16 @@
return (void*) p;
}
+
+void pa_close_pipe(int fds[2]) {
+ pa_assert(fds);
+
+ if (fds[0] >= 0)
+ pa_assert_se(pa_close(fds[0]) == 0);
+
+ if (fds[1] >= 0)
+ pa_assert_se(pa_close(fds[1]) == 0);
+
+ fds[0] = fds[1] = -1;
+}
+
Modified: branches/lennart/src/pulsecore/core-util.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/core-util.h?rev=1812&root=pulseaudio&r1=1811&r2=1812&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/core-util.h (original)
+++ branches/lennart/src/pulsecore/core-util.h Wed Sep 12 02:17:51 2007
@@ -120,4 +120,6 @@
return n + 1;
}
+void pa_close_pipe(int fds[2]);
+
#endif
Modified: branches/lennart/src/pulsecore/fdsem.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/fdsem.c?rev=1812&root=pulseaudio&r1=1811&r2=1812&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/fdsem.c (original)
+++ branches/lennart/src/pulsecore/fdsem.c Wed Sep 12 02:17:51 2007
@@ -67,8 +67,7 @@
void pa_fdsem_free(pa_fdsem *f) {
pa_assert(f);
- pa_assert_se(pa_close(f->fds[0]) == 0);
- pa_assert_se(pa_close(f->fds[1]) == 0);
+ pa_close_pipe(f->fds);
pa_xfree(f);
}
More information about the pulseaudio-commits
mailing list