From cece5aa4d3c0ac2364045d1adda8c36e9359adc2 Mon Sep 17 00:00:00 2001 From: Oskari Timperi Date: Sun, 18 May 2014 10:39:50 +0300 Subject: init builtin atoms with gcc constructor --- atom.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/atom.c b/atom.c index 2167442..9496390 100644 --- a/atom.c +++ b/atom.c @@ -8,6 +8,13 @@ struct atom true_atom = { ATOM_TRUE }; struct atom false_atom = { ATOM_FALSE }; struct atom nil_atom = { ATOM_NIL } ; +__attribute__((constructor)) +static void setup_builtin_atoms() +{ + nil_atom.list = calloc(1, sizeof(*nil_atom.list)); + LIST_INIT(nil_atom.list); +} + struct atom *atom_new(char type) { struct atom *atom = calloc(1, sizeof(*atom)); -- cgit v1.2.3