From d281288f8c222f11b2126f48f0e7b13481b0bba5 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Fri, 30 Mar 2012 14:10:01 +0200 Subject: [PATCH 1/1] Log constructor: guard against multiple initializations. --- include/xbt/log.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/xbt/log.h b/include/xbt/log.h index a398c405e2..8a40ef10f3 100644 --- a/include/xbt/log.h +++ b/include/xbt/log.h @@ -140,9 +140,11 @@ typedef enum { void _XBT_LOGV_CTOR(catName)(void) \ { \ XBT_LOG_EXTERNAL_CATEGORY(catName); \ - /* Note: _XBT_LOGV(parent) should be already declared here. */ \ - XBT_LOG_CONNECT_PARENT(catName, parent); \ - _xbt_log_cat_init(&_XBT_LOGV(catName), xbt_log_priority_uninitialized); \ + if (!_XBT_LOGV(catName).initialized) { \ + /* Note: _XBT_LOGV(parent) should be already declared here. */ \ + XBT_LOG_CONNECT_PARENT(catName, parent); \ + _xbt_log_cat_init(&_XBT_LOGV(catName), xbt_log_priority_uninitialized); \ + } \ } \ XBT_EXPORT_NO_IMPORT(s_xbt_log_category_t) _XBT_LOGV(catName) = { \ _XBT_LOG_PARENT_INITIALIZER(parent), \ -- 2.20.1