From 99d2363c6278af63f26ed93e0c922dad348ba88a Mon Sep 17 00:00:00 2001 From: Guillaume Chatelet Date: Wed, 13 Nov 2019 11:22:31 +0100 Subject: [PATCH] [NFC] fix various errors --- src/utils/list_cpu_features.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/utils/list_cpu_features.c b/src/utils/list_cpu_features.c index fbaf811..d2e485c 100644 --- a/src/utils/list_cpu_features.c +++ b/src/utils/list_cpu_features.c @@ -141,7 +141,7 @@ static Node* CreatePrintfString(const char* format, ...) { char* const ptr = gBumpAllocator.ptr; const int written = vsnprintf(ptr, gBumpAllocator.size, format, arglist); va_end(arglist); - if (written < 0 || written >= gBumpAllocator.size) internal_error(); + if (written < 0 || written >= (int)gBumpAllocator.size) internal_error(); return CreateConstantString((char*)BA_Bump(written)); } @@ -231,6 +231,8 @@ static void printJsonString(const char* str) { static void printJson(const Node* current) { assert(current); switch (current->type) { + case NT_INVALID: + break; case NT_INT: printf("%d", current->integer); break; @@ -268,6 +270,8 @@ static void printJson(const Node* current) { // Walks a Node and print it as text. static void printTextField(const Node* current) { switch (current->type) { + case NT_INVALID: + break; case NT_INT: printf("%3d (0x%02X)", current->integer, current->integer); break; @@ -314,7 +318,7 @@ static void showUsage(const char* name) { } static Node* CreateTree() { - Node* root = CreateMap(gBumpAllocator); + Node* root = CreateMap(); #if defined(CPU_FEATURES_ARCH_X86) char brand_string[49]; const X86Info info = GetX86Info(); @@ -367,7 +371,7 @@ static Node* CreateTree() { int main(int argc, char** argv) { BA_Align(); - const Node* const root = CreateTree(&gBumpAllocator); + const Node* const root = CreateTree(); bool outputJson = false; int i = 1; for (; i < argc; ++i) {