From: Shao Miller Date: Tue, 25 Jan 2011 02:47:43 +0000 (-0500) Subject: memdisk: Make debug-mode a tad prettier X-Git-Tag: syslinux-4.04-pre5~1^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=13101c28a48c226bdb25b27278014e84ee9f0874;p=platform%2Fupstream%2Fsyslinux.git memdisk: Make debug-mode a tad prettier By removing the use of #ifdef-#endif blocks. Signed-off-by: Shao Miller --- diff --git a/memdisk/dskprobe.c b/memdisk/dskprobe.c index de858bb..5c9d601 100644 --- a/memdisk/dskprobe.c +++ b/memdisk/dskprobe.c @@ -16,17 +16,23 @@ * Routines for probing BIOS disk drives */ -/* - * Uncomment for debugging - * - * #define DBG_DSKPROBE 1 - */ +/* Change to 1 for debugging */ +#define DBG_DSKPROBE 0 #include #include "memdisk.h" #include "bda.h" #include "conio.h" +/* Function type for printf() */ +typedef int (f_printf) (const char *, ...); + +/* Dummy printf() that does nothing */ +static f_printf no_printf; +static f_printf *dskprobe_printfs[] = { no_printf, printf }; + +#define dskprobe_printf (dskprobe_printfs[DBG_DSKPROBE]) + /* * We will probe a BIOS drive numer using INT 13h, AH=probe * and will pass along that call's success or failure @@ -43,9 +49,8 @@ int probe_int13_ah(uint8_t drive, uint8_t probe) intcall(0x13, ®s, ®s); err = !(regs.eflags.l & 1); -#ifdef DBG_DSKPROBE - printf("probe_int13_ah(0x%02x, 0x%02x) == %d\n", drive, probe, err); -#endif + dskprobe_printf("probe_int13_ah(0x%02x, 0x%02x) == %d\n", drive, probe, + err); return err; } @@ -72,10 +77,8 @@ int probe_bda_drive(uint8_t drive) bios_drives = 0; } err = (drive - (drive & 0x80)) >= bios_drives ? 0 : 1; -#ifdef DBG_DSKPROBE - printf("probe_bda_drive(0x%02x) == %d, count: %d\n", - drive, err, bios_drives); -#endif + dskprobe_printf("probe_bda_drive(0x%02x) == %d, count: %d\n", drive, err, + bios_drives); return err; } @@ -112,3 +115,10 @@ uint8_t probe_drive_range(uint8_t start) } return drive; } + +/* Dummy printf() that does nothing */ +static int no_printf(const char *ignored, ...) +{ + (void)ignored; + return 0; +}