summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2007-12-31 02:04:39 +0000
committer Aaron Giles <aaron@aarongiles.com>2007-12-31 02:04:39 +0000
commit460437f8d13a49302d5ce11cf5ba613083e4780a (patch)
treefcc6a7819ef6078d7ba6925e368438e33d62d06e /src/lib
parent3f6e8e1abfc478371e1e6f1a9cd317fbf5460424 (diff)
(From Atari Ace)
The attached patch adjusts most conditional logging in MAME to use the idiom "do { if (VERBOSE) logerror x; } while (0)". This has the benefit that the compiler checks the syntax of the logging even in the case it will be eliminated, and in fact a number of cases here needed adjustments to compile because of this.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/util/cdrom.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/lib/util/cdrom.c b/src/lib/util/cdrom.c
index 82287ad30eb..865fcd31286 100644
--- a/src/lib/util/cdrom.c
+++ b/src/lib/util/cdrom.c
@@ -24,8 +24,9 @@
***************************************************************************/
#define VERBOSE (0)
+#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
-
+void CLIB_DECL logerror(const char *text,...);
/***************************************************************************
TYPE DEFINITIONS
@@ -123,9 +124,7 @@ cdrom_file *cdrom_open(chd_file *chd)
return NULL;
}
- #if VERBOSE
- logerror("CD has %d tracks\n", file->cdtoc.numtrks);
- #endif
+ LOG(("CD has %d tracks\n", file->cdtoc.numtrks));
/* calculate the starting frame for each track, keeping in mind that CHDMAN
pads tracks out with extra frames to fit hunk size boundries
@@ -140,8 +139,7 @@ cdrom_file *cdrom_open(chd_file *chd)
chdofs += file->cdtoc.tracks[i].frames;
chdofs += file->cdtoc.tracks[i].extraframes;
- #if VERBOSE
- logerror("Track %02d is format %d subtype %d datasize %d subsize %d frames %d extraframes %d physofs %d chdofs %d\n", i+1,
+ LOG(("Track %02d is format %d subtype %d datasize %d subsize %d frames %d extraframes %d physofs %d chdofs %d\n", i+1,
file->cdtoc.tracks[i].trktype,
file->cdtoc.tracks[i].subtype,
file->cdtoc.tracks[i].datasize,
@@ -149,8 +147,7 @@ cdrom_file *cdrom_open(chd_file *chd)
file->cdtoc.tracks[i].frames,
file->cdtoc.tracks[i].extraframes,
file->cdtoc.tracks[i].physframeofs,
- file->cdtoc.tracks[i].chdframeofs);
- #endif
+ file->cdtoc.tracks[i].chdframeofs));
}
/* fill out dummy entries for the last track to help our search */
@@ -237,9 +234,7 @@ UINT32 cdrom_read_data(cdrom_file *file, UINT32 lbasector, void *buffer, UINT32
return 1;
}
- #if VERBOSE
- logerror("CDROM: Conversion from type %d to type %d not supported!\n", tracktype, datatype);
- #endif
+ LOG(("CDROM: Conversion from type %d to type %d not supported!\n", tracktype, datatype));
return 0;
}
return 1;