/* common */
#include "chartype.h"
+#include "strbuf.h"
#include "xsprintf.h"
/* ld65 */
void CfgWarning (const char* Format, ...)
/* Print a warning message adding file name and line number of the config file */
{
- char Buf [512];
+ StrBuf Buf = STATIC_STRBUF_INITIALIZER;
va_list ap;
va_start (ap, Format);
- xvsprintf (Buf, sizeof (Buf), Format, ap);
+ SB_VPrintf (&Buf, Format, ap);
va_end (ap);
- Warning ("%s(%u): %s", CfgGetName(), CfgErrorLine, Buf);
+ Warning ("%s(%u): %s", CfgGetName(), CfgErrorLine, SB_GetConstBuf (&Buf));
+ DoneStrBuf (&Buf);
}
void CfgError (const char* Format, ...)
/* Print an error message adding file name and line number of the config file */
{
- char Buf [512];
+ StrBuf Buf = STATIC_STRBUF_INITIALIZER;
va_list ap;
va_start (ap, Format);
- xvsprintf (Buf, sizeof (Buf), Format, ap);
+ SB_VPrintf (&Buf, Format, ap);
va_end (ap);
- Error ("%s(%u): %s", CfgGetName(), CfgErrorLine, Buf);
+ Error ("%s(%u): %s", CfgGetName(), CfgErrorLine, SB_GetConstBuf (&Buf));
+ DoneStrBuf (&Buf);
}
if (C == '$') {
NextChar ();
if (!isxdigit (C)) {
- Error ("%s(%u): Hex digit expected", CfgGetName(), InputLine);
+ CfgError ("Hex digit expected");
}
CfgIVal = 0;
while (isxdigit (C)) {
I = 0;
while (C != '\"') {
if (C == EOF || C == '\n') {
- Error ("%s(%u): Unterminated string", CfgName, InputLine);
+ CfgError ("Unterminated string");
}
if (I < CFG_MAX_IDENT_LEN) {
CfgSVal [I++] = C;
break;
default:
- Error ("%s(%u): Invalid character `%c'", CfgGetName(), InputLine, C);
+ CfgError ("Invalid character `%c'", C);
}
}
}
/* Not found or no identifier */
- Error ("%s(%u): %s expected", CfgGetName(), InputLine, Name);
+ CfgError ("%s expected", Name);
}