From 74484aec2e253462c43b50f450d034f3b5ebaf53 Mon Sep 17 00:00:00 2001 From: flobernd Date: Mon, 14 Aug 2017 17:10:24 +0200 Subject: [PATCH] Removed trailing whitespace after mnemonic for instructions without visible operands --- src/Formatter.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Formatter.c b/src/Formatter.c index 061febb..0f16935 100644 --- a/src/Formatter.c +++ b/src/Formatter.c @@ -857,11 +857,6 @@ static ZydisStatus ZydisFormatterFormatInstrIntel(const ZydisFormatter* formatte ZYDIS_CHECK(formatter->funcPrintMnemonic(formatter, buffer, bufEnd - *buffer, instruction)); char* bufRestore = *buffer; - if (instruction->operandCount > 0) - { - ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer, 0, " ")); - } - for (uint8_t i = 0; i < instruction->operandCount; ++i) { if (instruction->operands[i].visibility == ZYDIS_OPERAND_VISIBILITY_HIDDEN) @@ -869,7 +864,10 @@ static ZydisStatus ZydisFormatterFormatInstrIntel(const ZydisFormatter* formatte break; } - if (i != 0) + if (i == 0) + { + ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer, 0, " ")); + } else { bufRestore = *buffer; ZYDIS_CHECK(ZydisStringBufferAppend(buffer, bufEnd - *buffer, 0, ", "));