From db911c66230c83c9c9e92489edf371a0fdb6db09 Mon Sep 17 00:00:00 2001
From: Alexey Andreev <konsoletyper@gmail.com>
Date: Mon, 15 Jul 2019 15:22:43 +0300
Subject: [PATCH] C: fix compilation on Linux

---
 core/src/main/resources/org/teavm/backend/c/runtime.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/core/src/main/resources/org/teavm/backend/c/runtime.c b/core/src/main/resources/org/teavm/backend/c/runtime.c
index bb1f33de6..3255ca6d2 100644
--- a/core/src/main/resources/org/teavm/backend/c/runtime.c
+++ b/core/src/main/resources/org/teavm/backend/c/runtime.c
@@ -466,7 +466,11 @@ char* teavm_char16ToMb(char16_t* javaChars, int32_t length) {
 }
 
 TeaVM_Array* teavm_parseArguments(int argc, char** argv) {
-    TeaVM_Array* array = teavm_allocateStringArray(max(argc - 1, 0));
+    int arraySize = argc - 1;
+    if (arraySize < 0) {
+        arraySize - 1;
+    }
+    TeaVM_Array* array = teavm_allocateStringArray(arraySize);
     TeaVM_String** arrayData = TEAVM_ARRAY_DATA(array, TeaVM_String*);
     for (int i = 1; i < argc; ++i) {
         arrayData[i - 1] = teavm_cToString(argv[i]);