fixed incorrect offsets , cleaned out redundant code

This commit is contained in:
paul moore
2023-12-02 11:04:25 -08:00
parent ca2cf4bf54
commit 116f678180
2 changed files with 7 additions and 9 deletions

View File

@@ -705,6 +705,7 @@ ExpandParam:
if (new_expand_line) { if (new_expand_line) {
StrBuf mac_line = MakeLineFromTokens (Mac->Exp); StrBuf mac_line = MakeLineFromTokens (Mac->Exp);
NewListingLine (&mac_line, 0, 0); NewListingLine (&mac_line, 0, 0);
InitListingLine ();
SB_Done (&mac_line); SB_Done (&mac_line);
new_expand_line = 0; new_expand_line = 0;
} }
@@ -1107,17 +1108,12 @@ static StrBuf MakeLineFromTokens (TokNode* first)
/* is it a string of some sort?*/ /* is it a string of some sort?*/
unsigned len = SB_GetLen (&token->SVal); unsigned len = SB_GetLen (&token->SVal);
if (len > 0) { if (len > 0) {
token_string = xmalloc (len + 1); SB_Append (&T, &token->SVal);
memcpy (token_string, SB_GetBuf (&token->SVal), len);
token_string[len] = 0;
SB_AppendStr (&T, token_string);
xfree (token_string);
} else if (token->Tok == TOK_INTCON) { } else if (token->Tok == TOK_INTCON) {
char ival[12]; // max size a long can be char ival[12]; // max size a long can be
snprintf (ival, sizeof(ival), "%ld", token->IVal); snprintf (ival, sizeof(ival), "%ld", token->IVal);
SB_AppendStr (&T, ival); SB_AppendStr (&T, ival);
} else if ((token_string = GetTokenString (token)) != NULL) } else if ((token_string = GetTokenString (token)) != NULL) {
{
SB_AppendStr (&T, token_string); SB_AppendStr (&T, token_string);
} }
SB_Append (&S, &T); SB_Append (&S, &T);

View File

@@ -702,9 +702,11 @@ static void OneLine (void)
int Instr = -1; int Instr = -1;
/* Initialize the new listing line if we are actually reading from file /* Initialize the new listing line if we are actually reading from file
** and not from internally pushed input, unless expanding macros ** and not from internally pushed input
*/ */
if (!HavePushedInput () || ExpandMacros) {
if (!HavePushedInput () ) {
InitListingLine (); InitListingLine ();
} }