]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - ansi.c
Constant folding for strings
[xonotic/gmqcc.git] / ansi.c
diff --git a/ansi.c b/ansi.c
index 4f0cb095a8022758f2b8f3528d8516c7d9663e24..1317e150b0c4afa808283901645a319e83920a6b 100644 (file)
--- a/ansi.c
+++ b/ansi.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012, 2013
+ * Copyright (C) 2012, 2013, 2014, 2015
  *     Dale Weiler
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy of
@@ -23,7 +23,6 @@
 #define GMQCC_PLATFORM_HEADER
 #include <string.h>
 #include <stdlib.h>
-#include <unistd.h>
 
 #include "platform.h"
 #include "gmqcc.h"
@@ -63,6 +62,9 @@ int platform_vasprintf(char **dat, const char *fmt, va_list args) {
     len = vsnprintf(buf, sizeof(buf), fmt, cpy);
     va_end (cpy);
 
+    if (len < 0)
+        return len;
+
     if (len < (int)sizeof(buf)) {
         *dat = util_strdup(buf);
         return len;