From 4038700812f4b32cbcbad6408eec7598b4511f04 Mon Sep 17 00:00:00 2001 From: Aaron Jones Date: Fri, 18 Jan 2019 03:28:23 +0000 Subject: [PATCH] container/index: initialise index_heap at load time Fixes compiler diagnostic: index.c:34:1: warning: no previous prototype for function 'mowgli_index_init' [-Wmissing-prototypes] --- src/libmowgli/container/index.c | 6 ++++-- src/libmowgli/core/bootstrap.c | 1 + src/libmowgli/core/bootstrap_internal.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libmowgli/container/index.c b/src/libmowgli/container/index.c index ed2dc8d..646c962 100644 --- a/src/libmowgli/container/index.c +++ b/src/libmowgli/container/index.c @@ -19,6 +19,7 @@ */ #include "mowgli.h" +#include "core/bootstrap_internal.h" struct mowgli_index_ { @@ -31,9 +32,10 @@ struct mowgli_index_ static mowgli_heap_t *index_heap = NULL; void -mowgli_index_init(void) +mowgli_index_bootstrap(void) { - index_heap = mowgli_heap_create(sizeof(mowgli_index_t), 32, BH_NOW); + if (! (index_heap = mowgli_heap_create(sizeof(mowgli_index_t), 32, BH_NOW))) + abort(); } mowgli_index_t * diff --git a/src/libmowgli/core/bootstrap.c b/src/libmowgli/core/bootstrap.c index add6cd8..f57168b 100644 --- a/src/libmowgli/core/bootstrap.c +++ b/src/libmowgli/core/bootstrap.c @@ -47,6 +47,7 @@ MOWGLI_BOOTSTRAP_FUNC(mowgli_bootstrap_real) mowgli_memslice_bootstrap(); mowgli_cacheline_bootstrap(); mowgli_interface_bootstrap(); + mowgli_index_bootstrap(); #ifdef _WIN32 mowgli_winsock_bootstrap(); diff --git a/src/libmowgli/core/bootstrap_internal.h b/src/libmowgli/core/bootstrap_internal.h index 462f501..6f9ef2d 100644 --- a/src/libmowgli/core/bootstrap_internal.h +++ b/src/libmowgli/core/bootstrap_internal.h @@ -38,6 +38,7 @@ extern void mowgli_node_bootstrap(void); extern void mowgli_object_class_bootstrap(void); extern void mowgli_queue_bootstrap(void); extern void mowgli_random_bootstrap(void); +extern void mowgli_index_bootstrap(void); #ifdef _WIN32 extern void mowgli_winsock_bootstrap(void);