Fix a problem where the linker tries to print a NULL pointer if there is a
problem with the builtin configuration that is used. git-svn-id: svn://svn.cc65.org/cc65/trunk@1083 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -92,7 +92,7 @@ void CfgWarning (const char* Format, ...)
|
|||||||
xvsprintf (Buf, sizeof (Buf), Format, ap);
|
xvsprintf (Buf, sizeof (Buf), Format, ap);
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
|
||||||
Warning ("%s(%u): %s", CfgName, CfgErrorLine, Buf);
|
Warning ("%s(%u): %s", CfgGetName(), CfgErrorLine, Buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ void CfgError (const char* Format, ...)
|
|||||||
xvsprintf (Buf, sizeof (Buf), Format, ap);
|
xvsprintf (Buf, sizeof (Buf), Format, ap);
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
|
||||||
Error ("%s(%u): %s", CfgName, CfgErrorLine, Buf);
|
Error ("%s(%u): %s", CfgGetName(), CfgErrorLine, Buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ static void NextChar (void)
|
|||||||
/* Read from buffer */
|
/* Read from buffer */
|
||||||
C = (unsigned char)(*CfgBuf);
|
C = (unsigned char)(*CfgBuf);
|
||||||
if (C == 0) {
|
if (C == 0) {
|
||||||
C = EOF;
|
C = EOF;
|
||||||
} else {
|
} else {
|
||||||
++CfgBuf;
|
++CfgBuf;
|
||||||
}
|
}
|
||||||
@@ -254,7 +254,7 @@ Again:
|
|||||||
case ':':
|
case ':':
|
||||||
NextChar ();
|
NextChar ();
|
||||||
CfgTok = CFGTOK_COLON;
|
CfgTok = CFGTOK_COLON;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\"':
|
case '\"':
|
||||||
NextChar ();
|
NextChar ();
|
||||||
@@ -297,7 +297,7 @@ Again:
|
|||||||
CfgSVal [0] = '\0';
|
CfgSVal [0] = '\0';
|
||||||
}
|
}
|
||||||
CfgTok = CFGTOK_STRCON;
|
CfgTok = CFGTOK_STRCON;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'S':
|
case 'S':
|
||||||
NextChar ();
|
NextChar ();
|
||||||
@@ -426,7 +426,7 @@ void CfgSpecialToken (const IdentTok* Table, unsigned Size, const char* Name)
|
|||||||
|
|
||||||
/* Linear search */
|
/* Linear search */
|
||||||
for (I = 0; I < Size; ++I) {
|
for (I = 0; I < Size; ++I) {
|
||||||
if (strcmp (CfgSVal, Table [I].Ident) == 0) {
|
if (strcmp (CfgSVal, Table [I].Ident) == 0) {
|
||||||
CfgTok = Table [I].Tok;
|
CfgTok = Table [I].Tok;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -475,7 +475,13 @@ void CfgSetName (const char* Name)
|
|||||||
const char* CfgGetName (void)
|
const char* CfgGetName (void)
|
||||||
/* Get the name of the config file */
|
/* Get the name of the config file */
|
||||||
{
|
{
|
||||||
return CfgName? CfgName : "";
|
if (CfgName) {
|
||||||
|
return CfgName;
|
||||||
|
} else if (CfgBuf) {
|
||||||
|
return "[builtin config]";
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user