From: uz Date: Tue, 3 Apr 2012 17:35:34 +0000 (+0000) Subject: Reenable Break(), use a string buffer for safe formatting. X-Git-Tag: V2.14~425 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=032c16dda4fae7f7932d7ff5bbf0ca4270a78130;p=cc65 Reenable Break(), use a string buffer for safe formatting. git-svn-id: svn://svn.cc65.org/cc65/trunk@5642 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/sim65/cpucore.c b/src/sim65/cpucore.c index aa3a69070..39929634d 100644 --- a/src/sim65/cpucore.c +++ b/src/sim65/cpucore.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 2002-2003 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ +/* (C) 2003-2012, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -41,7 +41,7 @@ #include "abend.h" #include "attrib.h" #include "print.h" -#include "xsprintf.h" +#include "strbuf.h" /* sim65 */ #include "cpuregs.h" @@ -75,7 +75,7 @@ int HaveIRQRequest = 0; int CPUHalted = 0; /* Break message */ -static char BreakMsg[1024]; +static StrBuf BreakMsg = STATIC_STRBUF_INITIALIZER; @@ -2518,12 +2518,10 @@ void RESET (void) void Break (const char* Format, ...) /* Stop running and display the given message */ { -#if 0 va_list ap; va_start (ap, Format); - xvsprintf (BreakMsg, sizeof (BreakMsg), Format, ap); + SB_VPrintf (&BreakMsg, Format, ap); va_end (ap); -#endif } @@ -2570,9 +2568,9 @@ void CPURun (void) /* Count cycles */ TotalCycles += Cycles; - if (BreakMsg[0]) { - printf ("%s\n", BreakMsg); - BreakMsg[0] = '\0'; + if (SB_GetLen (&BreakMsg) > 0) { + printf ("%.*s\n", SB_GetLen (&BreakMsg), SB_GetConstBuf (&BreakMsg)); + SB_Clear (&BreakMsg); } }