From: Arnaud Giersch Date: Fri, 30 Mar 2012 12:10:01 +0000 (+0200) Subject: Log constructor: guard against multiple initializations. X-Git-Tag: v3_7~136 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/d281288f8c222f11b2126f48f0e7b13481b0bba5 Log constructor: guard against multiple initializations. --- 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), \