diff options
author | 2008-07-24 06:26:47 +0000 | |
---|---|---|
committer | 2008-07-24 06:26:47 +0000 | |
commit | 0b77a69691d6c7ef7117f9c141bd1301d083011c (patch) | |
tree | 44a4d7c1042bd2941364ccad406c9e72bfabc3ff /src/emu/sound/fmopl.c | |
parent | 9b63c422030b302154ad57541ccc5375cdc7e215 (diff) |
From: Atari Ace [mailto:atari_ace@verizon.net]
Subject: [patch] Conditional code cleanup resubmit
Hi mamedev,
This is a resubmit of a previous patch. The earlier version would not
compile with 32-bit MSVC, due to the fact that its linker required
external dependencies in dead code to be met before dead code
elimination was done, causing linker errors. The proper fix for this
would be to add the necessary dependencies, so I instead simply left
the conditional code in place in winalloc.c and chd.c.
~aa
Original submission email below:
----
Conditionally compiled code tends to bitrot, so MAME should try to
avoid it as much as possible. I sent a patch six months ago to
eliminate conditional code associated with logging, here's another
patch that does more of this. Some notes:
1. drc_ops.c: I couldn't find a LOG_CODE anywhere, so I used if (0).
2. romload.c: I converted all the users of debugload to use
LOG((...)) instead, following the traditional conditional logging
pattern.
3. windows/sound.c: I eliminated the separate sound log and directed
the few outputs to the error log.
~aa
Diffstat (limited to 'src/emu/sound/fmopl.c')
-rw-r--r-- | src/emu/sound/fmopl.c | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/src/emu/sound/fmopl.c b/src/emu/sound/fmopl.c index 820c3ed51a4..d0892a98bf4 100644 --- a/src/emu/sound/fmopl.c +++ b/src/emu/sound/fmopl.c @@ -186,10 +186,8 @@ static FILE *sample[1]; #endif #endif -/* #define LOG_CYM_FILE */ -#ifdef LOG_CYM_FILE - FILE * cymfile = NULL; -#endif +#define LOG_CYM_FILE 0 +static FILE * cymfile = NULL; @@ -1458,13 +1456,11 @@ static void OPLWriteReg(FM_OPL *OPL, int r, int v) r &= 0xff; v &= 0xff; -#ifdef LOG_CYM_FILE - if ((cymfile) && (r!=0) ) + if (LOG_CYM_FILE && (cymfile) && (r!=0) ) { fputc( (unsigned char)r, cymfile ); fputc( (unsigned char)v, cymfile ); } -#endif switch(r&0xe0) @@ -1721,7 +1717,6 @@ static void OPLWriteReg(FM_OPL *OPL, int r, int v) } } -#ifdef LOG_CYM_FILE static TIMER_CALLBACK( cymfile_callback ) { if (cymfile) @@ -1729,7 +1724,6 @@ static TIMER_CALLBACK( cymfile_callback ) fputc( (unsigned char)0, cymfile ); } } -#endif /* lock/unlock for common table */ static int OPL_LockTable(void) @@ -1747,13 +1741,14 @@ static int OPL_LockTable(void) return -1; } -#ifdef LOG_CYM_FILE - cymfile = fopen("3812_.cym","wb"); - if (cymfile) - timer_pulse ( ATTOTIME_IN_HZ(110), 0, cymfile_callback); /*110 Hz pulse timer*/ - else - logerror("Could not create file 3812_.cym\n"); -#endif + if (LOG_CYM_FILE) + { + cymfile = fopen("3812_.cym","wb"); + if (cymfile) + timer_pulse ( ATTOTIME_IN_HZ(110), NULL, 0, cymfile_callback); /*110 Hz pulse timer*/ + else + logerror("Could not create file 3812_.cym\n"); + } return 0; } @@ -1768,11 +1763,9 @@ static void OPL_UnLockTable(void) cur_chip = NULL; OPLCloseTable(); -#ifdef LOG_CYM_FILE - fclose (cymfile); + if (cymfile) + fclose (cymfile); cymfile = NULL; -#endif - } static void OPLResetChip(FM_OPL *OPL) |