Debian Codegraph @

libmowgli-2/src/libmowgli/core/bootstrap.c

raw
1 /*
2 * libmowgli: A collection of useful routines for programming.
3 * bootstrap.c: Initialization of libmowgli.
4 *
5 * Copyright (c) 2007 William Pitcock <nenolod -at- sacredspiral.co.uk>
6 *
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice is present in all copies.
10 *
11 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
12 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
13 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
14 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
15 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
16 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
17 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
18 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
19 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
20 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
21 * POSSIBILITY OF SUCH DAMAGE.
22 */
23
24 #include "mowgli.h"
25 #include "core/bootstrap_internal.h"
26
27 /* TODO: rename to mowgli_bootstrap next time there is a LIB_MAJOR bump */
28 MOWGLI_BOOTSTRAP_FUNC(mowgli_bootstrap_real)
29 {
30 static bool bootstrapped = 0;
31
32 if (bootstrapped)
33 return;
34
35 /* initial bootstrap */
36 mowgli_log_bootstrap();
37 mowgli_node_bootstrap();
38 mowgli_queue_bootstrap();
39 mowgli_object_class_bootstrap();
40 mowgli_argstack_bootstrap();
41 mowgli_bitvector_bootstrap();
42 mowgli_global_storage_bootstrap();
43 mowgli_hook_bootstrap();
44 mowgli_random_bootstrap();
45 mowgli_allocation_policy_bootstrap();
46 mowgli_allocator_bootstrap();
47 mowgli_memslice_bootstrap();
48 mowgli_cacheline_bootstrap();
49 mowgli_interface_bootstrap();
50 mowgli_index_bootstrap();
51
52 #ifdef _WIN32
53 mowgli_winsock_bootstrap();
54 #endif
55
56 /* now that we're bootstrapped, we can use a more optimised allocator
57 if one is available. */
58 mowgli_allocator_set_policy(mowgli_allocator_malloc);
59
60 bootstrapped = true;
61 }
62
63 void
64 mowgli_init(void)
65 {
66 mowgli_log("mowgli_init() is a deprecated function, provided only for backwards compatibility with Mowgli-1. You should remove it if you no longer support using Mowgli-1.");
67 }