From 0cef042c575a19b4d97f8621c7f958e0512a4dbd Mon Sep 17 00:00:00 2001
From: Jens Gustedt <Jens.Gustedt@loria.fr>
Date: Sat, 29 Dec 2012 19:59:45 +0100
Subject: [PATCH] add some fifo initialization

---
 p99/p99_clib.h | 2 +-
 p99/p99_lifo.h | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/p99/p99_clib.h b/p99/p99_clib.h
index effb306c..ea275d04 100644
--- a/p99/p99_clib.h
+++ b/p99/p99_clib.h
@@ -56,7 +56,7 @@ void *aligned_alloc(size_t p00_alignment, size_t p00_size) {
 /* In both cases this is guaranteed to do the correct
    initialization. */
 P99_WEAK(p00_cb)
-p99_callback_stack p00_at_quick_exit;
+p99_callback_stack p00_at_quick_exit = P99_LIFO_INITIALIZER(0);
 
 /**
  ** @brief registers the function pointed to by @a p00_void_func, to be called
diff --git a/p99/p99_lifo.h b/p99/p99_lifo.h
index 64284346..63251eaf 100644
--- a/p99/p99_lifo.h
+++ b/p99/p99_lifo.h
@@ -32,7 +32,7 @@
 # define P99_LIFO_DECLARE(T)                    \
 typedef T P99_PASTE2(p00_lifo_, T);             \
 P99_DECLARE_ATOMIC(P99_PASTE2(p00_lifo_, T))
-
+# define P99_LIFO_INITIALIZER(VAL) ATOMIC_VAR_INIT((void*)VAL)
 
 /**
  ** @brief Return a pointer to the top element of an atomic LIFO @a L
@@ -134,6 +134,7 @@ P00_DOCUMENT_PERMITTED_ARGUMENT(P99_LIFO_CLEAR, 0)
 
 # define P99_LIFO(T) P99_PASTE2(p00_lifo_, T)
 # define P99_LIFO_DECLARE(T) typedef T P99_LIFO(T)
+# define P99_LIFO_INITIALIZER(VAL) ((void*)VAL)
 
 #define P99_LIFO_TOP(L)  (*(L))
 
-- 
GitLab