aboutsummaryrefslogtreecommitdiffstats
path: root/src/macros.h
diff options
context:
space:
mode:
authorLibravatar bigfoot547 <[email protected]>2023-12-31 02:39:11 -0600
committerLibravatar bigfoot547 <[email protected]>2023-12-31 02:39:11 -0600
commit7c95357610f722db4ee1f684086fb4478e3875c3 (patch)
treea9464f42f256467eaac96ef29ec75acfcbb7b046 /src/macros.h
parentadd a little version stuff (diff)
downloads versions now
Diffstat (limited to 'src/macros.h')
-rw-r--r--src/macros.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/macros.h b/src/macros.h
index 8be48dd..00e80a6 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -9,7 +9,9 @@
#include <alloca.h>
#include <string.h>
+#include <stdio.h>
+/* I LOVE ALLOCA */
#define L2_ASTRCAT2(_var, _s1, _len1, _s2, _len2) do { \
_var = alloca(_len1 + _len2 + 1); \
memcpy(_var, (_s1), (_len1)); \
@@ -17,6 +19,12 @@
(_var)[((_len1) + (_len2))] = '\0'; \
} while (0)
+#define L2_ASPRINTF(_var, _tmp, _fmt, ...) do { \
+ _tmp = snprintf(NULL, 0, _fmt, __VA_ARGS__); \
+ _var = alloca(_tmp + 1); \
+ snprintf(_var, _tmp + 1, _fmt, __VA_ARGS__); \
+} while (0)
+
#define L2_USER_AGENT PROJECT_NAME "/0.1.0 <[email protected]>"
#define L2_URL_META_BASE "https://piston-meta.mojang.com"