summaryrefslogtreecommitdiff
path: root/ds.h
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-09-13 23:11:15 -0400
committerpommicket <pommicket@gmail.com>2023-09-14 10:47:51 -0400
commit52015e0c9a4e3bc8dc558929a85461f079dda303 (patch)
treebfdf9bda87934dbd96d4da1e87454d22184545b7 /ds.h
parente33379bab95031555ed5459ee8a73672f24fd0a0 (diff)
batch write requests, fix tiny memory leak in ide-autocomplete
Diffstat (limited to 'ds.h')
-rw-r--r--ds.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/ds.h b/ds.h
index a5033f7..8cd30e6 100644
--- a/ds.h
+++ b/ds.h
@@ -28,9 +28,20 @@ IMPORTANT NOTE: If you are using this with structures containing `long double`s,
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-
-typedef uint32_t u32;
-typedef uint8_t u8;
+#include <stdarg.h>
+#include <stddef.h>
+
+#ifndef SHORT_FIXED_SIZE_TYPES
+ typedef uint8_t u8;
+ typedef uint16_t u16;
+ typedef uint32_t u32;
+ typedef uint64_t u64;
+ typedef int8_t i8;
+ typedef int16_t i16;
+ typedef int32_t i32;
+ typedef int64_t i64;
+ #define SHORT_FIXED_SIZE_TYPES
+#endif
typedef union {
long num;
@@ -407,7 +418,7 @@ static void str_builder_append_null(StrBuilder *builder, size_t n) {
arr_set_len(builder->str, arr_len(builder->str) + n);
}
-static u32 str_builder_len(StrBuilder *builder) {
+static u32 str_builder_len(const StrBuilder *builder) {
assert(builder->str);
return arr_len(builder->str) - 1;
}