Removed trailing whitespace after mnemonic for instructions without visible operands

This commit is contained in:
flobernd 2017-08-14 17:10:24 +02:00
parent 705f0ed5cd
commit 74484aec2e
1 changed files with 4 additions and 6 deletions

View File

@ -857,11 +857,6 @@ static ZydisStatus ZydisFormatterFormatInstrIntel(const ZydisFormatter* formatte
ZYDIS_CHECK(formatter->funcPrintMnemonic(formatter, buffer, bufEnd - *buffer, instruction)); ZYDIS_CHECK(formatter->funcPrintMnemonic(formatter, buffer, bufEnd - *buffer, instruction));
char* bufRestore = *buffer; char* bufRestore = *buffer;
if (instruction->operandCount > 0)
{
ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer, 0, " "));
}
for (uint8_t i = 0; i < instruction->operandCount; ++i) for (uint8_t i = 0; i < instruction->operandCount; ++i)
{ {
if (instruction->operands[i].visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN) if (instruction->operands[i].visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN)
@ -869,7 +864,10 @@ static ZydisStatus ZydisFormatterFormatInstrIntel(const ZydisFormatter* formatte
break; break;
} }
if (i != 0) if (i == 0)
{
ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer, 0, " "));
} else
{ {
bufRestore = *buffer; bufRestore = *buffer;
ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer, 0, ", ")); ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer, 0, ", "));