Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fight against multiple 'extern' specification
[simgrid.git] / include / xbt / log.h
index efbd868..6b77148 100644 (file)
@@ -160,26 +160,22 @@ typedef enum {
  * Creates a new subcategory of the root category and makes it the default
  * (used by macros that don't explicitly specify a category).
  */
-
-  /*
 #if (defined(_WIN32) && !defined(DLL_STATIC))
 # define XBT_LOG_NEW_ROOT_SUBCATEGORY(cname,desc) \
        XBT_EXPORT_NO_IMPORT(s_xbt_log_category_t) _XBT_LOGV(cname) = {       \
         0, 0, 0,                    \
                #cname, xbt_log_priority_uninitialized, 1, \
-        0, 1                                          \
+        0, 0, 1                                          \
     }
 # define XBT_LOG_NEW_DEFAULT_CATEGORY(cname,desc)        \
        XBT_LOG_NEW_ROOT_SUBCATEGORY(cname,desc); \
        XBT_LOG_DEFAULT_CATEGORY(cname)
     
 #else
-*/
 # define XBT_LOG_NEW_DEFAULT_CATEGORY(cname,desc)        \
     XBT_LOG_NEW_CATEGORY(cname,desc);                   \
     XBT_LOG_DEFAULT_CATEGORY(cname)
-   
-//#endif
+#endif
 
 
 
@@ -234,6 +230,7 @@ typedef struct xbt_log_category_s s_xbt_log_category_t,*xbt_log_category_t;
 /*
  * Do NOT access any members of this structure directly. FIXME: move to private?
  */
+#define XBT_LOG_BUFF_SIZE 2048 /* Size of the static string in which we build the log string */
 struct xbt_log_category_s {
   xbt_log_category_t parent;
   xbt_log_category_t firstChild; 
@@ -266,8 +263,8 @@ struct xbt_log_event_s {
   const char* fileName;
   const char* functionName;
   int lineNum;
-  char buffer[1024];
   va_list ap;
+  char buffer[XBT_LOG_BUFF_SIZE];
 };
 
 /**
@@ -346,7 +343,7 @@ XBT_PUBLIC(int) _xbt_log_cat_init(xbt_log_category_t   category,
                                  e_xbt_log_priority_t priority);
 
 
-extern XBT_IMPORT_NO_EXPORT(s_xbt_log_category_t) _XBT_LOGV(XBT_LOG_ROOT_CAT);
+XBT_PUBLIC_DATA(s_xbt_log_category_t) _XBT_LOGV(XBT_LOG_ROOT_CAT);
 
 XBT_LOG_EXTERNAL_CATEGORY(GRAS);
 
@@ -400,7 +397,7 @@ extern xbt_log_layout_t xbt_log_default_layout;
 #define _XBT_LOG_PRE(catv, priority) do {                       \
      if (_XBT_LOG_ISENABLEDV(catv, priority)) {                  \
          s_xbt_log_event_t _log_ev =                             \
-             {NULL,priority,__FILE__,_XBT_FUNCTION,__LINE__,{'\0'}}; \
+             {NULL,priority,__FILE__,_XBT_FUNCTION,__LINE__}; \
                 _log_ev.cat = &(catv);                           \
               _xbt_log_event_log(&_log_ev                       \