[winealsa] Cosmetic stuff

Maarten Lankhorst m.b.lankhorst at gmail.com
Mon Jan 29 09:27:14 CST 2007


Change debug channel of alsa.c to something more appropiate and move the #ifdef's to clean the code up a little.

-------------- next part --------------
>From 880630bebf7991de84ae8d73b0423915072a234c Mon Sep 17 00:00:00 2001
From: maarten <maarten at maarten-laptop.(none)>
Date: Mon, 29 Jan 2007 16:14:50 +0100
Subject: [PATCH] Cosmetic issues
---
 dlls/winealsa.drv/alsa.c |   25 +++++++------------------
 1 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/dlls/winealsa.drv/alsa.c b/dlls/winealsa.drv/alsa.c
index 6f7b535..567c069 100644
--- a/dlls/winealsa.drv/alsa.c
+++ b/dlls/winealsa.drv/alsa.c
@@ -45,12 +45,13 @@ #include "wine/library.h"
 #include "wine/unicode.h"
 #include "wine/debug.h"
 
-WINE_DEFAULT_DEBUG_CHANNEL(wave);
-
+WINE_DEFAULT_DEBUG_CHANNEL(alsa);
 /* unless someone makes a wineserver kernel module, Unix pipes are faster than win32 events */
 #define USE_PIPE_SYNC
 
 #ifdef USE_PIPE_SYNC
+#define INIT_OMR(omr) do { if (pipe(omr->msg_pipe) < 0) { omr->msg_pipe[0] = omr->msg_pipe[1] = -1; } } while (0)
+#define CLOSE_OMR(Omr) do { close(omr->msg_pipe[0]); close(omr->msg_pipe[1]); } while (0)
 #define SIGNAL_OMR(omr) do { int x = 0; write((omr)->msg_pipe[1], &x, sizeof(x)); } while (0)
 #define CLEAR_OMR(omr) do { int x = 0; read((omr)->msg_pipe[0], &x, sizeof(x)); } while (0)
 #define RESET_OMR(omr) do { } while (0)
@@ -58,6 +59,8 @@ #define WAIT_OMR(omr, sleep) \
   do { struct pollfd pfd; pfd.fd = (omr)->msg_pipe[0]; \
        pfd.events = POLLIN; poll(&pfd, 1, sleep); } while (0)
 #else
+#define INIT_OMR(omr) do { omr->msg_event = CreateEventW(NULL, FALSE, FALSE, NULL); } while (0)
+#define CLOSE_OMR(omr) do { CloseHandle(omr->msg_event); } while (0)
 #define SIGNAL_OMR(omr) do { SetEvent((omr)->msg_event); } while (0)
 #define CLEAR_OMR(omr) do { } while (0)
 #define RESET_OMR(omr) do { ResetEvent((omr)->msg_event); } while (0)
@@ -77,15 +80,7 @@ int ALSA_InitRingMessage(ALSA_MSG_RING* 
 {
     omr->msg_toget = 0;
     omr->msg_tosave = 0;
-#ifdef USE_PIPE_SYNC
-    if (pipe(omr->msg_pipe) < 0) {
-        omr->msg_pipe[0] = -1;
-        omr->msg_pipe[1] = -1;
-        ERR("could not create pipe, error=%s\n", strerror(errno));
-    }
-#else
-    omr->msg_event = CreateEventW(NULL, FALSE, FALSE, NULL);
-#endif
+    INIT_OMR(omr);
     omr->ring_buffer_size = ALSA_RING_BUFFER_INCREMENT;
     omr->messages = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,omr->ring_buffer_size * sizeof(ALSA_MSG));
 
@@ -100,12 +95,7 @@ #endif
  */
 int ALSA_DestroyRingMessage(ALSA_MSG_RING* omr)
 {
-#ifdef USE_PIPE_SYNC
-    close(omr->msg_pipe[0]);
-    close(omr->msg_pipe[1]);
-#else
-    CloseHandle(omr->msg_event);
-#endif
+    CLOSE_OMR(omr);
     HeapFree(GetProcessHeap(),0,omr->messages);
     omr->ring_buffer_size = 0;
     omr->msg_crst.DebugInfo->Spare[0] = 0;
@@ -145,7 +135,6 @@ int ALSA_AddRingMessage(ALSA_MSG_RING* o
     {
 	int old_ring_buffer_size = omr->ring_buffer_size;
 	omr->ring_buffer_size += ALSA_RING_BUFFER_INCREMENT;
-	TRACE("omr->ring_buffer_size=%d\n",omr->ring_buffer_size);
 	omr->messages = HeapReAlloc(GetProcessHeap(),0,omr->messages, omr->ring_buffer_size * sizeof(ALSA_MSG));
 	/* Now we need to rearrange the ring buffer so that the new
 	   buffers just allocated are in between omr->msg_tosave and
-- 
1.4.1



More information about the wine-patches mailing list