commit b288b379066749378cb9ef93a278bbc4f3b5f466
parent 5a06a36c495ea11c4c09230596cae99384d2682e
Author: William Casarin <jb55@jb55.com>
Date: Sat, 22 Jul 2023 12:02:13 -0700
fix build on some compilers
Diffstat:
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
@@ -10,9 +10,11 @@ clean:
tags:
ctags *.c *.h
+benchmark: bench
+ ./bench
+
bench: bench.c $(DEPS)
$(CC) $(CFLAGS) bench.c nostrdb.c -o $@
- ./bench
test: test.c $(DEPS)
$(CC) $(CFLAGS) test.c nostrdb.c -o $@
diff --git a/bench.c b/bench.c
@@ -33,7 +33,7 @@ static int bench_parser(int times, const char *json, int len)
int main(int argc, char *argv[], char **env)
{
static const int alloc_size = 2 << 18;
- int times = 10000, len;
+ int times = 10000, len = 0;
unsigned char buf[alloc_size];
if (!read_file("contacts.json", buf, alloc_size, &len))
diff --git a/test.c b/test.c
@@ -97,7 +97,7 @@ static void test_empty_tags() {
static void test_parse_contact_list()
{
- int size, written;
+ int size, written = 0;
static const int alloc_size = 2 << 18;
unsigned char *json = malloc(alloc_size);
unsigned char *buf = malloc(alloc_size);