Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Some work to get it ansi compliant, still much to doo
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 28 Sep 2004 09:18:54 +0000 (09:18 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 28 Sep 2004 09:18:54 +0000 (09:18 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@430 48e7efb5-ca39-0410-a469-dd3cf9ba447f

19 files changed:
include/xbt/log.h
include/xbt/sysdep.h
src/gras/DataDesc/cbps.c
src/gras/DataDesc/datadesc_private.h
src/gras/DataDesc/ddt_convert.c
src/gras/DataDesc/ddt_create.c
src/gras/DataDesc/ddt_exchange.c
src/gras/DataDesc/ddt_parse.c
src/gras/DataDesc/ddt_parse.yy.c
src/gras/DataDesc/ddt_parse.yy.l
src/gras/Transport/transport.c
src/gras/Transport/transport_plugin_buf.c
src/xbt/config.c
src/xbt/dict.c
src/xbt/dict_cursor.c
src/xbt/dict_elm.c
src/xbt/dynar.c
src/xbt/log.c
src/xbt/log_default_appender.c

index 78027b6..5b92f13 100644 (file)
@@ -11,7 +11,7 @@
 /* GRAS_LOG_MAYDAY: define this to replace the logging facilities with basic
    printf function. Useful to debug the logging facilities themselves */
 #undef GRAS_LOG_MAYDAY
-//#define GRAS_LOG_MAYDAY
+/*#define GRAS_LOG_MAYDAY*/
 
 
 #ifndef _GRAS_LOG_H_
@@ -97,7 +97,7 @@ typedef enum {
         &_GRAS_LOGV(parent), 0, 0,                    \
         #catName, gras_log_priority_uninitialized, 1, \
         0, 1                                          \
-    };
+    }
 
 /**
  * GRAS_LOG_NEW_CATEGORY:
@@ -144,7 +144,7 @@ typedef enum {
  * (used by macros that don't explicitly specify a category).
  */
 #define GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(cname, parent, desc) \
-    GRAS_LOG_NEW_SUBCATEGORY(cname, parent, desc)             \
+    GRAS_LOG_NEW_SUBCATEGORY(cname, parent, desc);            \
     GRAS_LOG_DEFAULT_CATEGORY(cname)
 
 /**
@@ -158,11 +158,11 @@ typedef enum {
 #define GRAS_LOG_EXTERNAL_CATEGORY(cname) \
    extern gras_log_category_t _GRAS_LOGV(cname)
 
-// Functions you may call
+/* Functions you may call */
 
 extern gras_error_t gras_log_control_set(const char* cs);
 
-// Forward declarations
+/* Forward declarations */
 typedef struct gras_log_appender_s gras_log_appender_t;
 typedef struct gras_log_event_s    gras_log_event_t;
 typedef struct gras_log_category_s gras_log_category_t;
@@ -179,7 +179,7 @@ struct gras_log_category_s {
             int isThreshInherited;
 /*@null@*/  gras_log_appender_t *appender;
             int willLogToParent;
-  // TODO: Formats?
+  /* TODO: Formats? */
 };
 
 struct gras_log_appender_s {
@@ -227,14 +227,10 @@ extern void gras_log_parent_set(gras_log_category_t* cat,
 extern void gras_log_appender_set(gras_log_category_t* cat,
                                  gras_log_appender_t* app);
 
-// Functions that you shouldn't call. 
+/* Functions that you shouldn't call. */
 extern void _gras_log_event_log(gras_log_event_t*ev,
                                const char *fmt,
-                               ...)
-#ifdef __GNUC__
-     __attribute__ ((format (printf, 2, 3)))
-#endif
-;
+                               ...) _GRAS_GNUC_PRINTF(2,3);
 
 extern int _gras_log_cat_init(gras_log_priority_t priority, 
                              gras_log_category_t* category);
@@ -286,7 +282,7 @@ extern gras_log_appender_t *gras_log_default_appender;
 #define _GRAS_LOG_PRE(catv, priority) do {                              \
      if (_GRAS_LOG_ISENABLEDV(catv, priority)) {                        \
          gras_log_event_t _log_ev =                                     \
-             {&(catv),priority,__FILE__,__FUNCTION__,__LINE__};         \
+             {&(catv),priority,__FILE__,_GRAS_GNUC_FUNCTION,__LINE__};         \
          _gras_log_event_log(&_log_ev
 
 #define _GRAS_LOG_POST                          \
@@ -559,21 +555,11 @@ extern gras_log_appender_t *gras_log_default_appender;
 #define CRITICAL5(f,a1,a2,a3,a4,a5)    LOG5(gras_log_priority_critical, f,a1,a2,a3,a4,a5)
 #define CRITICAL6(f,a1,a2,a3,a4,a5,a6) LOG6(gras_log_priority_critical, f,a1,a2,a3,a4,a5,a6)
 
-#ifdef __GNUC__
-#define GRAS_IN               LOG1(gras_log_priority_trace, ">> begin of %s",     __FUNCTION__)
-#define GRAS_IN1(fmt,a)       LOG2(gras_log_priority_trace, ">> begin of %s" fmt, __FUNCTION__, a)
-#define GRAS_IN2(fmt,a,b)     LOG3(gras_log_priority_trace, ">> begin of %s" fmt, __FUNCTION__, a,b)
-#define GRAS_IN3(fmt,a,b,c)   LOG4(gras_log_priority_trace, ">> begin of %s" fmt, __FUNCTION__, a,b,c)
-#define GRAS_IN4(fmt,a,b,c,d) LOG5(gras_log_priority_trace, ">> begin of %s" fmt, __FUNCTION__, a,b,c,d)
-#define GRAS_OUT              LOG1(gras_log_priority_trace, "<< end of %s",       __FUNCTION__)
-#else /* if fool enough to compile without gcc */
-#define GRAS_IN               LOG0(gras_log_priority_trace, ">> begin of function")
-#define GRAS_IN1(fmt,a)       LOG2(gras_log_priority_trace, ">> begin of function " fmt, a)
-#define GRAS_IN2(fmt,a,b)     LOG3(gras_log_priority_trace, ">> begin of function " fmt, a,b)
-#define GRAS_IN3(fmt,a,b,c)   LOG4(gras_log_priority_trace, ">> begin of function " fmt, a,b,c)
-#define GRAS_IN4(fmt,a,b,c,d) LOG5(gras_log_priority_trace, ">> begin of function " fmt, a,b,c,d)
-
-#define GRAS_OUT(fmt,a) LOG0(gras_log_priority_trace, "<< end of function")
-#endif /* end of foolness for non-gcc */
+#define GRAS_IN               LOG1(gras_log_priority_trace, ">> begin of %s",     _GRAS_GNUC_FUNCTION)
+#define GRAS_IN1(fmt,a)       LOG2(gras_log_priority_trace, ">> begin of %s" fmt, _GRAS_GNUC_FUNCTION, a)
+#define GRAS_IN2(fmt,a,b)     LOG3(gras_log_priority_trace, ">> begin of %s" fmt, _GRAS_GNUC_FUNCTION, a,b)
+#define GRAS_IN3(fmt,a,b,c)   LOG4(gras_log_priority_trace, ">> begin of %s" fmt, _GRAS_GNUC_FUNCTION, a,b,c)
+#define GRAS_IN4(fmt,a,b,c,d) LOG5(gras_log_priority_trace, ">> begin of %s" fmt, _GRAS_GNUC_FUNCTION, a,b,c,d)
+#define GRAS_OUT              LOG1(gras_log_priority_trace, "<< end of %s",       _GRAS_GNUC_FUNCTION)
 
 #endif /* ! _GRAS_LOG_H_ */
index 2d7c63c..e012812 100644 (file)
@@ -31,22 +31,37 @@ void  gras_free    (void  *memory);
 #define gras_new(type, count)  ((type*)gras_malloc (sizeof (type) * (count)))
 #define gras_new0(type, count) ((type*)gras_malloc0 (sizeof (type) * (count)))
 
+/* Attributes are only in recent versions of GCC */
+
 #if     __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
-#define _GRAS_GNUC_PRINTF( format_idx, arg_idx )    \
+# define _GRAS_GNUC_PRINTF( format_idx, arg_idx )    \
           __attribute__((__format__ (__printf__, format_idx, arg_idx)))
-#define _GRAS_GNUC_SCANF( format_idx, arg_idx )     \
+# define _GRAS_GNUC_SCANF( format_idx, arg_idx )     \
               __attribute__((__format__ (__scanf__, format_idx, arg_idx)))
-#define _GRAS_GNUC_FORMAT( arg_idx )                \
+# define _GRAS_GNUC_FORMAT( arg_idx )                \
                   __attribute__((__format_arg__ (arg_idx)))
-#define _GRAS_GNUC_NORETURN                         \
-     __attribute__((__noreturn__))
+# define _GRAS_GNUC_NORETURN __attribute__((__noreturn__))
+
 #else   /* !__GNUC__ */
-#define _GRAS_GNUC_PRINTF( format_idx, arg_idx )
-#define _GRAS_GNUC_SCANF( format_idx, arg_idx )
-#define _GRAS_GNUC_FORMAT( arg_idx )
-#define _GRAS_GNUC_NORETURN
+# define _GRAS_GNUC_PRINTF( format_idx, arg_idx )
+# define _GRAS_GNUC_SCANF( format_idx, arg_idx )
+# define _GRAS_GNUC_FORMAT( arg_idx )
+# define _GRAS_GNUC_NORETURN
+
 #endif  /* !__GNUC__ */
 
+/* inline and __FUNCTION__ are only in GCC when -ansi is of */
+
+#if defined(__GNUC__) && ! defined(__STRICT_ANSI__)
+
+# define _GRAS_GNUC_FUNCTION __FUNCTION__
+# define _GRAS_INLINE inline
+#else
+# define _GRAS_GNUC_FUNCTION "function"
+# define _GRAS_INLINE 
+#endif
+
+
 void gras_abort(void) _GRAS_GNUC_NORETURN;
 
 /* FIXME: This is a very good candidate to rewrite (along with a proper string stuff) 
index f0c9c64..623902a 100644 (file)
@@ -81,9 +81,9 @@ gras_cbps_v_push(gras_cbps_t        *ps,
   gras_dynar_t            *varstack,*frame;
   gras_cbps_elm_t      *p_var;
   gras_error_t errcode;
-  char *varname = strdup(name);
+  char *varname = (char*)strdup(name);
 
-  DEBUG2("push(%s,%p)",name,data);
+  DEBUG2("push(%s,%p)",name,(void*)data);
   errcode = gras_dict_get(ps->space, name, (void **)&varstack);
  
   if (errcode == mismatch_error) {
@@ -102,7 +102,7 @@ gras_cbps_v_push(gras_cbps_t        *ps,
   gras_dynar_push(varstack, &p_var);
   
   gras_dynar_pop(ps->frames, &frame);
-  DEBUG4("Push %s (%p @%p) into frame %p",varname,varname,&varname,frame);
+  DEBUG4("Push %s (%p @%p) into frame %p",varname,(void*)varname,(void*)&varname,(void*)frame);
   gras_dynar_push(frame, &varname);
   gras_dynar_push(ps->frames, &frame); 
   return no_error;
@@ -284,7 +284,7 @@ gras_cbps_block_end(gras_cbps_t *ps) {
     gras_dynar_t            *varstack    = NULL;
     gras_cbps_elm_t      *var         = NULL;
  
-    DEBUG2("Get ride of %s (%p)",name,name);
+    DEBUG2("Get ride of %s (%p)",name,(void*)name);
     gras_dict_get(ps->space, name, (void **)&varstack);
     gras_dynar_pop(varstack, &var);
  
index f0001eb..b058176 100644 (file)
@@ -165,8 +165,8 @@ typedef struct s_gras_dd_cat_ref {
 typedef struct s_gras_dd_cat_array {
   gras_datadesc_type_t *type;
 
-  /* element_count < 0 means dynamically defined */
-  long int                       fixed_size;
+  /* element_count == 0 means dynamically defined */
+  unsigned long int           fixed_size;
 
   /* callback used to return the dynamic length */
   gras_datadesc_type_cb_int_t dynamic_size;
@@ -215,10 +215,10 @@ struct s_gras_datadesc_type {
   unsigned int                         name_len;
         
   /* payload */
-  long int                             size[gras_arch_count];
+  unsigned long int                    size[gras_arch_count];
   
-  long int                             alignment[gras_arch_count];  
-  long int                             aligned_size[gras_arch_count];
+  unsigned long int                    alignment[gras_arch_count];  
+  unsigned long int                    aligned_size[gras_arch_count];
   
   enum  e_gras_datadesc_type_category  category_code;
   union u_gras_datadesc_category       category;
index 99f3390..a5da480 100644 (file)
@@ -29,19 +29,19 @@ GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_convert,datadesc,
  ***/
 
 const gras_arch_desc_t gras_arches[gras_arch_count] = {
-  {"little32", 0,   {1,2,4,4,8,   4,4,   4,8}, // 4},
+  {"little32", 0,   {1,2,4,4,8,   4,4,   4,8}, 
                     {1,2,4,4,4,   4,4,   4,4}},
 
-  {"little64", 0,   {1,2,4,8,8,   8,8,   4,8}, // 8},
+  {"little64", 0,   {1,2,4,8,8,   8,8,   4,8}, 
                     {1,2,4,8,8,   8,8,   4,8}},
 
-  {"big32",    1,   {1,2,4,4,8,   4,4,   4,8}, // 8},
+  {"big32",    1,   {1,2,4,4,8,   4,4,   4,8}, 
                     {1,2,4,4,8,   4,4,   4,8}},
 
-  {"big64",    1,   {1,2,4,8,8,   8,8,   4,8}, // 8}
+  {"big64",    1,   {1,2,4,8,8,   8,8,   4,8}, 
                     {1,2,4,8,8,   8,8,   4,8}},
 
-  {"aix",      1,   {1,2,4,4,8,   4,4,   4,8}, // 8}
+  {"aix",      1,   {1,2,4,4,8,   4,4,   4,8}, 
                     {1,2,4,4,8,   4,4,   4,4}}
    
 };
index 0bc8dae..7bc27bc 100644 (file)
@@ -36,7 +36,7 @@ gras_ddt_new(const char            *name,
   if (!res) 
     RAISE_MALLOC;
 
-  res->name = strdup(name);
+  res->name = (char*)strdup(name);
   res->name_len = strlen(name);
       
   *dst=res;
@@ -232,7 +232,7 @@ gras_datadesc_struct_append(gras_datadesc_type_t  *struct_type,
     return no_error;
   }
 
-  gras_assert1(field_type->size >= 0,
+  gras_assert1(field_type->size != 0,
               "Cannot add a dynamically sized field in structure %s",
               struct_type->name);
     
@@ -240,7 +240,7 @@ gras_datadesc_struct_append(gras_datadesc_type_t  *struct_type,
   if (!field)
     RAISE_MALLOC;
 
-  field->name   = strdup(name);
+  field->name   = (char*)strdup(name);
 
   DEBUG0("----------------");
   DEBUG3("PRE s={size=%ld,align=%ld,asize=%ld}",
@@ -347,7 +347,7 @@ gras_datadesc_union_append(gras_datadesc_type_t  *union_type,
   int arch;
 
   GRAS_IN3("(%s %s.%s;)",field_type->name,union_type->name,name);
-  gras_assert1(field_type->size >= 0,
+  gras_assert1(field_type->size != 0,
               "Cannot add a dynamically sized field in union %s",
               union_type->name);
 
@@ -361,7 +361,7 @@ gras_datadesc_union_append(gras_datadesc_type_t  *union_type,
   if (!field)
     RAISE_MALLOC;
 
-  field->name   = strdup(name);
+  field->name   = (char*)strdup(name);
   field->type   = field_type;
   /* All offset are left to 0 in an union */
   
@@ -509,7 +509,7 @@ gras_datadesc_array_fixed(const char              *name,
   TRY(gras_ddt_new(name,dst));
   res=*dst;
 
-  gras_assert1(fixed_size > 0, "'%s' is a array of negative fixed size",name);
+  gras_assert1(fixed_size > 0, "'%s' is a array of null fixed size",name);
   for (arch=0; arch<gras_arch_count; arch ++) {
     res->size[arch] = fixed_size * element_type->aligned_size[arch];
     res->alignment[arch] = element_type->alignment[arch];
@@ -550,7 +550,7 @@ gras_datadesc_array_dyn(const char                      *name,
                 "Redefinition of type %s does not match", name);
     gras_assert1(res->category.array_data.type == element_type,
                 "Redefinition of type %s does not match", name);
-    gras_assert1(res->category.array_data.fixed_size == -1,
+    gras_assert1(res->category.array_data.fixed_size == 0,
                 "Redefinition of type %s does not match", name);
     gras_assert1(res->category.array_data.dynamic_size == dynamic_size,
                 "Redefinition of type %s does not match", name);
@@ -564,15 +564,15 @@ gras_datadesc_array_dyn(const char                      *name,
   res=*dst;
 
   for (arch=0; arch<gras_arch_count; arch ++) {
-    res->size[arch] = -1; /* make sure it indicates "dynamic" */
+    res->size[arch] = 0; /* make sure it indicates "dynamic" */
     res->alignment[arch] = element_type->alignment[arch];
-    res->aligned_size[arch] = -1; /*FIXME: That was so in GS, but looks stupid*/
+    res->aligned_size[arch] = 0; /*FIXME: That was so in GS, but looks stupid*/
   }
 
   res->category_code           = e_gras_datadesc_type_cat_array;
 
   res->category.array_data.type         = element_type;
-  res->category.array_data.fixed_size   = -1;
+  res->category.array_data.fixed_size   = 0;
   res->category.array_data.dynamic_size = dynamic_size;
 
   return no_error;
@@ -666,7 +666,7 @@ static gras_datadesc_type_t *
    } else if (type->category_code == e_gras_datadesc_type_cat_struct) {
       field_array = type->category.struct_data.fields;
    } else {
-      ERROR2("%s (%p) is not a struct nor an union. There is no field.", type->name,type);
+      ERROR2("%s (%p) is not a struct nor an union. There is no field.", type->name,(void*)type);
       gras_abort();
    }
    gras_dynar_foreach(field_array,field_num,field) {
index f4f98f2..2800d4a 100644 (file)
@@ -28,14 +28,14 @@ const char *gras_datadesc_cat_names[9] = {
 
 static gras_datadesc_type_t *int_type = NULL;
 static gras_datadesc_type_t *pointer_type = NULL;    
-static inline gras_error_t gras_dd_send_int(gras_socket_t *sock,             int  i);
-static inline gras_error_t gras_dd_recv_int(gras_socket_t *sock, int r_arch, int *i);
+static _GRAS_INLINE gras_error_t gras_dd_send_int(gras_socket_t *sock,             int  i);
+static _GRAS_INLINE gras_error_t gras_dd_recv_int(gras_socket_t *sock, int r_arch, int *i);
 
-static inline gras_error_t
+static _GRAS_INLINE gras_error_t
 gras_dd_alloc_ref(gras_dict_t *refs,  long int     size,
                  char       **r_ref, long int     r_len,
                  char       **l_ref);
-static inline int 
+static _GRAS_INLINE int 
 gras_dd_is_r_null(char **r_ptr, long int length);
 
 static gras_error_t 
@@ -56,7 +56,7 @@ gras_datadesc_recv_rec(gras_socket_t        *sock,
                       int                   subsize);
 
 
-static inline gras_error_t
+static _GRAS_INLINE gras_error_t
 gras_dd_send_int(gras_socket_t *sock,int i) {
 
   if (!int_type) {
@@ -68,7 +68,7 @@ gras_dd_send_int(gras_socket_t *sock,int i) {
   return gras_trp_chunk_send(sock, (char*)&i, int_type->size[GRAS_THISARCH]);
 }
 
-static inline gras_error_t
+static _GRAS_INLINE gras_error_t
 gras_dd_recv_int(gras_socket_t *sock, int r_arch, int *i) {
   gras_error_t errcode;
 
@@ -100,7 +100,7 @@ gras_dd_recv_int(gras_socket_t *sock, int r_arch, int *i) {
  *       of 'length' bytes set to 0.
  * FIXME: Check in configure?
  */
-static inline int 
+static _GRAS_INLINE int 
 gras_dd_is_r_null(char **r_ptr, long int length) {
   int i;
 
@@ -113,7 +113,7 @@ gras_dd_is_r_null(char **r_ptr, long int length) {
   return 1;
 }
 
-static inline gras_error_t
+static _GRAS_INLINE gras_error_t
 gras_dd_alloc_ref(gras_dict_t *refs,
                  long int     size,
                  char       **r_ref,
@@ -126,10 +126,10 @@ gras_dd_alloc_ref(gras_dict_t *refs,
     RAISE_MALLOC;
 
   *l_ref = l_data;
-  DEBUG2("l_data=%p, &l_data=%p",l_data,&l_data);
+  DEBUG2("l_data=%p, &l_data=%p",(void*)l_data,(void*)&l_data);
 
   DEBUG3("alloc_ref: r_ref=%p; *r_ref=%p, r_len=%ld",
-        r_ref, r_ref?*r_ref:NULL, r_len);
+        (void*)r_ref, (void*)(r_ref?*r_ref:NULL), r_len);
 #ifdef DETECT_CYCLE
   if (r_ref && !gras_dd_is_r_null( r_ref, r_len)) {
     gras_error_t errcode;
@@ -208,14 +208,14 @@ int gras_datadesc_type_cmp(const gras_datadesc_type_t *d1,
 
   if (d1->send != d2->send) {
     DEBUG4("ddt_cmp: %s->send=%p  !=  %s->send=%p",
-          d1->name,d1->send, d2->name,d2->send);
-    return d1->send > d2->send ? 1 : -1;
+          d1->name,(void*)d1->send, d2->name,(void*)d2->send);
+    return 1; /* ISO C forbids ordered comparisons of pointers to functions */
   }
 
   if (d1->recv != d2->recv) {
     DEBUG4("ddt_cmp: %s->recv=%p  !=  %s->recv=%p",
-          d1->name,d1->recv, d2->name,d2->recv);
-    return d1->recv > d2->recv ? 1 : -1;
+          d1->name,(void*)d1->recv, d2->name,(void*)d2->recv);
+    return 1; /* ISO C forbids ordered comparisons of pointers to functions */
   }
 
   switch (d1->category_code) {
@@ -253,7 +253,7 @@ int gras_datadesc_type_cmp(const gras_datadesc_type_t *d1,
     
   case e_gras_datadesc_type_cat_union:
     if (d1->category.union_data.selector != d2->category.union_data.selector) 
-      return d1->category.union_data.selector > d2->category.union_data.selector ? 1 : -1;
+      return 1;  /* ISO C forbids ordered comparisons of pointers to functions */
     
     if (gras_dynar_length(d1->category.union_data.fields) != 
        gras_dynar_length(d2->category.union_data.fields))
@@ -276,7 +276,7 @@ int gras_datadesc_type_cmp(const gras_datadesc_type_t *d1,
     
   case e_gras_datadesc_type_cat_ref:
     if (d1->category.ref_data.selector != d2->category.ref_data.selector) 
-      return d1->category.ref_data.selector > d2->category.ref_data.selector ? 1 : -1;
+      return 1; /* ISO C forbids ordered comparisons of pointers to functions */
     
     if (d1->category.ref_data.type != d2->category.ref_data.type) 
       return d1->category.ref_data.type > d2->category.ref_data.type ? 1 : -1;
@@ -290,7 +290,7 @@ int gras_datadesc_type_cmp(const gras_datadesc_type_t *d1,
       return d1->category.array_data.fixed_size > d2->category.array_data.fixed_size ? 1 : -1;
     
     if (d1->category.array_data.dynamic_size != d2->category.array_data.dynamic_size) 
-      return d1->category.array_data.dynamic_size > d2->category.array_data.dynamic_size ? 1 : -1;
+      return 1; /* ISO C forbids ordered comparisons of pointers to functions */
     
     break;
     
@@ -442,12 +442,12 @@ gras_datadesc_send_rec(gras_socket_t        *sock,
     }
     errcode = gras_dict_get_ext(refs,(char*)ref, sizeof(void*), &dummy);
     if (errcode == mismatch_error) {
-      VERB1("Sending data referenced at %p", *ref);
+      VERB1("Sending data referenced at %p", (void*)*ref);
       TRY(gras_dict_set_ext(refs, (char*)ref, sizeof(void*), ref, NULL));
       TRY(gras_datadesc_send_rec(sock,state,refs, sub_type, *ref));
       
     } else if (errcode == no_error) {
-      VERB1("Not sending data referenced at %p (already done)", *ref);
+      VERB1("Not sending data referenced at %p (already done)", (void*)*ref);
     } else {
       return errcode;
     }
@@ -465,7 +465,7 @@ gras_datadesc_send_rec(gras_socket_t        *sock,
     
     /* determine and send the element count */
     count = array_data.fixed_size;
-    if (count <= 0) {
+    if (count == 0) {
       count = array_data.dynamic_size(state,data);
       gras_assert1(count >=0,
                   "Invalid (negative) array size for type %s",type->name);
@@ -547,7 +547,7 @@ gras_datadesc_recv_rec(gras_socket_t        *sock,
   int                   cpt;
   gras_datadesc_type_t *sub_type;
 
-  VERB2("Recv a %s @%p", type->name, l_data);
+  VERB2("Recv a %s @%p", type->name, (void*)l_data);
   gras_assert(l_data);
 
   switch (type->category_code) {
@@ -661,7 +661,7 @@ gras_datadesc_recv_rec(gras_socket_t        *sock,
 
 
     if (errcode == mismatch_error) {
-      int subsubcount = -1;
+      int subsubcount = 0;
       void *l_referenced=NULL;
 
       VERB2("Receiving a ref to '%s', remotely @%p",
@@ -673,7 +673,7 @@ gras_datadesc_recv_rec(gras_socket_t        *sock,
        gras_datadesc_type_t *subsub_type;
 
        subsubcount = array_data.fixed_size;
-       if (subsubcount < 0)
+       if (subsubcount == 0)
          TRY(gras_dd_recv_int(sock, r_arch, &subsubcount));
 
        subsub_type = array_data.type;
@@ -718,13 +718,13 @@ gras_datadesc_recv_rec(gras_socket_t        *sock,
     array_data = type->category.array_data;
     /* determine element count locally, or from caller, or from peer */
     count = array_data.fixed_size;
-    if (count <= 0)
+    if (count == 0)
       count = subsize;
-    if (count < 0)
+    if (count == 0)
       TRY(gras_dd_recv_int(sock, r_arch, &count));
-    if (count < 0)
+    if (count == 0)
       RAISE1(mismatch_error,
-            "Invalid (negative) array size for type %s",type->name);
+            "Invalid (=0) array size for type %s",type->name);
 
     /* receive the content */
     sub_type = array_data.type;
index 41f3ba2..b2e9f8a 100644 (file)
@@ -154,7 +154,7 @@ static gras_error_t change_to_ref_pop_array(gras_dynar_t *dynar) {
   GRAS_IN;
   gras_dynar_pop(dynar,&former);
   TRY(gras_datadesc_ref_pop_arr(former.type,&ref.type)); /* redeclaration are ignored */
-  ref.type_name = strdup(ref.type->name);
+  ref.type_name = (char*)strdup(ref.type->name);
   ref.name = former.name;
 
   gras_free(former.type_name);
@@ -220,10 +220,10 @@ static gras_error_t parse_statement(char   *definition,
       strcmp(gras_ddt_parse_text,"int") ) {
 
     /* bastard user, they omited "int" ! */
-    identifier.type_name=strdup("int");
+    identifier.type_name=(char*)strdup("int");
     DEBUG0("the base type is 'int', which were omited (you vicious user)");
   } else {
-    identifier.type_name=strdup(gras_ddt_parse_text);
+    identifier.type_name=(char*)strdup(gras_ddt_parse_text);
     DEBUG1("the base type is '%s'",identifier.type_name);
     gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump(); 
   }
@@ -297,7 +297,7 @@ static gras_error_t parse_statement(char     *definition,
   /**** look for the symbols of this type ****/
   for(expect_id_separator = 0;
 
-      (//(gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_EMPTY) && FIXME
+      (/*(gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_EMPTY) && FIXME*/
        (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_SEMI_COLON)) ; 
 
       gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump()          ) {   
@@ -351,7 +351,7 @@ static gras_error_t parse_statement(char     *definition,
 
        if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD) 
          PARSE_ERROR1("Unparsable annotation: Expected key name, got '%s'",gras_ddt_parse_text);
-       keyname = strdup(gras_ddt_parse_text);
+       keyname = (char*)strdup(gras_ddt_parse_text);
 
        while ( (gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump()) == GRAS_DDT_PARSE_TOKEN_EMPTY );
 
@@ -362,7 +362,7 @@ static gras_error_t parse_statement(char     *definition,
 
        if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD) 
          PARSE_ERROR1("Unparsable annotation: Expected key value, got '%s'",gras_ddt_parse_text);
-       keyval = strdup(gras_ddt_parse_text);
+       keyval = (char*)strdup(gras_ddt_parse_text);
 
        while ( (gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump()) == GRAS_DDT_PARSE_TOKEN_EMPTY );
 
@@ -423,7 +423,7 @@ static gras_error_t parse_statement(char     *definition,
     /* found a symbol name. Build the type and push it to dynar */
     if(gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
 
-      identifier.name=strdup(gras_ddt_parse_text);
+      identifier.name=(char*)strdup(gras_ddt_parse_text);
       DEBUG1("Found the identifier \"%s\"",identifier.name);
       
       TRY(gras_dynar_push(identifiers, &identifier));
@@ -489,19 +489,19 @@ static gras_datadesc_type_t *parse_struct(char *definition) {
        PARSE_ERROR2("Not enough GRAS_ANNOTATE to deal with all dereferencing levels of %s (%d '*' left)",
                     field.name,field.tm.is_ref);
 
-      VERB2("Append field '%s' to %p",field.name, struct_type);      
+      VERB2("Append field '%s' to %p",field.name, (void*)struct_type);      
       TRYFAIL(gras_datadesc_struct_append(struct_type, field.name, field.type));
       gras_free(field.name);
       gras_free(field.type_name);
 
     }
     gras_dynar_reset(identifiers);
-    DEBUG1("struct_type=%p",struct_type);
+    DEBUG1("struct_type=%p",(void*)struct_type);
     
     /* Make sure that all fields declaring a size push it into the cbps */
     gras_dynar_foreach(fields_to_push,i, name) {
-      DEBUG1("struct_type=%p",struct_type);
-      VERB2("Push field '%s' into size stack of %p", name, struct_type);
+      DEBUG1("struct_type=%p",(void*)struct_type);
+      VERB2("Push field '%s' into size stack of %p", name, (void*)struct_type);
       gras_datadesc_cb_field_push(struct_type, name);
       gras_free(name);
     }
index 0d652ba..88b38a4 100644 (file)
@@ -441,7 +441,7 @@ char *yytext;
   int gras_ddt_parse_char_pos = 0;
   int gras_ddt_parse_tok_num = 0;
   const char *definition;
-  GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(ddt_lexer,ddt_parse,"Lexer of the parsing");
+  GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(lexer,ddt_parse,"The crude internals of the lexer used for type parsing");
 #define SHOW_WHERE DEBUG4("%d:%d (char #%d): seen '%s'", gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,gras_ddt_parse_char_pos,yytext)
 #define annotate 1
 #define comment 2
@@ -764,14 +764,16 @@ case 8:
 YY_RULE_SETUP
 #line 77 "gras/DataDesc/ddt_parse.yy.l"
 { /****************** COMMENTS ************************/
-        // constructs like /*g [string] g*/ are not comments but size annotations
+  /* constructs like : */
+    /*g [string] g*/ 
+  /* are not comments but size annotations */
   comment_caller = INITIAL;
   BEGIN(comment);
 }
        YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 83 "gras/DataDesc/ddt_parse.yy.l"
+#line 85 "gras/DataDesc/ddt_parse.yy.l"
 {
   comment_caller = foo;
   BEGIN(comment);
@@ -779,19 +781,19 @@ YY_RULE_SETUP
        YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 88 "gras/DataDesc/ddt_parse.yy.l"
+#line 90 "gras/DataDesc/ddt_parse.yy.l"
 { /* eat anything that's not a '*' */
 }
        YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 90 "gras/DataDesc/ddt_parse.yy.l"
+#line 92 "gras/DataDesc/ddt_parse.yy.l"
 { /* eat up '*'s not followed by '/'s */
 }
        YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 92 "gras/DataDesc/ddt_parse.yy.l"
+#line 94 "gras/DataDesc/ddt_parse.yy.l"
 {
   ++gras_ddt_parse_line_pos;
   gras_ddt_parse_col_pos=0;
@@ -800,7 +802,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 97 "gras/DataDesc/ddt_parse.yy.l"
+#line 99 "gras/DataDesc/ddt_parse.yy.l"
 {
   gras_ddt_parse_char_pos+= strlen(yytext);
   gras_ddt_parse_col_pos+= strlen(yytext);
@@ -809,7 +811,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 103 "gras/DataDesc/ddt_parse.yy.l"
+#line 105 "gras/DataDesc/ddt_parse.yy.l"
 {  /****************** STATEMENTS ************************/
   gras_ddt_parse_char_pos += strlen(yytext);
   gras_ddt_parse_col_pos += strlen(yytext);
@@ -819,7 +821,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 109 "gras/DataDesc/ddt_parse.yy.l"
+#line 111 "gras/DataDesc/ddt_parse.yy.l"
 { 
   gras_ddt_parse_char_pos++; 
   gras_ddt_parse_col_pos++; 
@@ -829,7 +831,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 115 "gras/DataDesc/ddt_parse.yy.l"
+#line 117 "gras/DataDesc/ddt_parse.yy.l"
 {
   gras_ddt_parse_char_pos++;
   gras_ddt_parse_col_pos++;
@@ -839,7 +841,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 121 "gras/DataDesc/ddt_parse.yy.l"
+#line 123 "gras/DataDesc/ddt_parse.yy.l"
 { 
   gras_ddt_parse_char_pos++; 
   gras_ddt_parse_col_pos++; 
@@ -849,7 +851,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 127 "gras/DataDesc/ddt_parse.yy.l"
+#line 129 "gras/DataDesc/ddt_parse.yy.l"
 {
   gras_ddt_parse_char_pos++;
   gras_ddt_parse_col_pos++;
@@ -859,7 +861,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 133 "gras/DataDesc/ddt_parse.yy.l"
+#line 135 "gras/DataDesc/ddt_parse.yy.l"
 { 
   gras_ddt_parse_char_pos++; 
   gras_ddt_parse_col_pos++; 
@@ -869,7 +871,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 139 "gras/DataDesc/ddt_parse.yy.l"
+#line 141 "gras/DataDesc/ddt_parse.yy.l"
 {
   gras_ddt_parse_char_pos++;
   gras_ddt_parse_col_pos++;
@@ -879,7 +881,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 145 "gras/DataDesc/ddt_parse.yy.l"
+#line 147 "gras/DataDesc/ddt_parse.yy.l"
 {
   gras_ddt_parse_char_pos++;
   gras_ddt_parse_col_pos++;
@@ -889,7 +891,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 151 "gras/DataDesc/ddt_parse.yy.l"
+#line 153 "gras/DataDesc/ddt_parse.yy.l"
 {
   gras_ddt_parse_char_pos++;
   gras_ddt_parse_col_pos++;
@@ -899,7 +901,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 157 "gras/DataDesc/ddt_parse.yy.l"
+#line 159 "gras/DataDesc/ddt_parse.yy.l"
 { 
   gras_ddt_parse_char_pos++;
   gras_ddt_parse_col_pos++;
@@ -909,7 +911,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 163 "gras/DataDesc/ddt_parse.yy.l"
+#line 165 "gras/DataDesc/ddt_parse.yy.l"
 {
  gras_ddt_parse_line_pos++; 
  gras_ddt_parse_char_pos++;
@@ -919,7 +921,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 169 "gras/DataDesc/ddt_parse.yy.l"
+#line 171 "gras/DataDesc/ddt_parse.yy.l"
 { 
   gras_ddt_parse_char_pos++;
   gras_ddt_parse_col_pos++;
@@ -928,10 +930,10 @@ YY_RULE_SETUP
        YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 174 "gras/DataDesc/ddt_parse.yy.l"
+#line 176 "gras/DataDesc/ddt_parse.yy.l"
 ECHO;
        YY_BREAK
-#line 935 "gras/DataDesc/ddt_parse.yy.c"
+#line 937 "gras/DataDesc/ddt_parse.yy.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(annotate):
 case YY_STATE_EOF(comment):
@@ -1824,7 +1826,7 @@ int main()
        return 0;
        }
 #endif
-#line 174 "gras/DataDesc/ddt_parse.yy.l"
+#line 176 "gras/DataDesc/ddt_parse.yy.l"
 
 /* {space}+                { return(TOKEN_SPACE);} */
 
@@ -1833,8 +1835,8 @@ void gras_ddt_parse_dump(void) {
   case GRAS_DDT_PARSE_TOKEN_LA      : {printf("TOKEN_LA ");break;}
   case GRAS_DDT_PARSE_TOKEN_RA      : {printf("TOKEN_RA ");break;}
   case GRAS_DDT_PARSE_TOKEN_WORD    : {printf("TOKEN_WORD ");break;}
-    //  case GRAS_DDT_PARSE_TOKEN_SPACE   : {printf("TOKEN_SPACE ");break;}
-    //  case GRAS_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;}
+    /*  case GRAS_DDT_PARSE_TOKEN_SPACE   : {printf("TOKEN_SPACE ");break;}*/
+    /*  case GRAS_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;}*/
   case GRAS_DDT_PARSE_TOKEN_NEWLINE : {printf("TOKEN_NEWLINE\n");return;}
   case GRAS_DDT_PARSE_TOKEN_EMPTY : {printf("TOKEN_EMPTY\n");return;}
   default             : {printf("Unknown token %d\n", gras_ddt_parse_tok_num);return;}
@@ -1845,7 +1847,7 @@ void gras_ddt_parse_dump(void) {
 
 int gras_ddt_parse_lex_n_dump(void) {
   gras_ddt_parse_tok_num = gras_ddt_parse_lex();
-  //  gras_ddt_parse_char_pos += strlen(yytext);
+  /*  gras_ddt_parse_char_pos += strlen(yytext);*/
   return(gras_ddt_parse_tok_num);
 }
 
@@ -1888,6 +1890,6 @@ void  gras_ddt_parse_pointer_string_close(void) {
   gras_ddt_parse_tok_num = 0;
 }
 
-// Local variables:
-// mode: c
-// End:
+/* Local variables:*/
+/* mode: c */
+/* End: */
index 007303b..0fe83b6 100644 (file)
@@ -21,7 +21,7 @@
   int gras_ddt_parse_char_pos = 0;
   int gras_ddt_parse_tok_num = 0;
   const char *definition;
-  GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(lexer,ddt_parse);
+  GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(lexer,ddt_parse,"The crude internals of the lexer used for type parsing");
 #define SHOW_WHERE DEBUG4("%d:%d (char #%d): seen '%s'", gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,gras_ddt_parse_char_pos,yytext)
 %}
 
@@ -75,7 +75,9 @@ digit           [0-9]
 }
 
 "/*[^g]"   { /****************** COMMENTS ************************/
-        // constructs like /*g [string] g*/ are not comments but size annotations
+  /* constructs like : */
+    /*g [string] g*/ 
+  /* are not comments but size annotations */
   comment_caller = INITIAL;
   BEGIN(comment);
 }
@@ -179,8 +181,8 @@ void gras_ddt_parse_dump(void) {
   case GRAS_DDT_PARSE_TOKEN_LA      : {printf("TOKEN_LA ");break;}
   case GRAS_DDT_PARSE_TOKEN_RA      : {printf("TOKEN_RA ");break;}
   case GRAS_DDT_PARSE_TOKEN_WORD    : {printf("TOKEN_WORD ");break;}
-    //  case GRAS_DDT_PARSE_TOKEN_SPACE   : {printf("TOKEN_SPACE ");break;}
-    //  case GRAS_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;}
+    /*  case GRAS_DDT_PARSE_TOKEN_SPACE   : {printf("TOKEN_SPACE ");break;}*/
+    /*  case GRAS_DDT_PARSE_TOKEN_COMMENT : {printf("TOKEN_COMMENT ");break;}*/
   case GRAS_DDT_PARSE_TOKEN_NEWLINE : {printf("TOKEN_NEWLINE\n");return;}
   case GRAS_DDT_PARSE_TOKEN_EMPTY : {printf("TOKEN_EMPTY\n");return;}
   default             : {printf("Unknown token %d\n", gras_ddt_parse_tok_num);return;}
@@ -191,7 +193,7 @@ void gras_ddt_parse_dump(void) {
 
 int gras_ddt_parse_lex_n_dump(void) {
   gras_ddt_parse_tok_num = gras_ddt_parse_lex();
-  //  gras_ddt_parse_char_pos += strlen(yytext);
+  /*  gras_ddt_parse_char_pos += strlen(yytext);*/
   return(gras_ddt_parse_tok_num);
 }
 
@@ -234,6 +236,6 @@ void  gras_ddt_parse_pointer_string_close(void) {
   gras_ddt_parse_tok_num = 0;
 }
 
-// Local variables:
-// mode: c
-// End:
+/* Local variables:*/
+/* mode: c */
+/* End: */
index 5d440fc..252efee 100644 (file)
@@ -31,7 +31,7 @@ gras_trp_plugin_new(const char *name, gras_trp_setup_t setup) {
   if (!plug) 
     RAISE_MALLOC;
 
-  plug->name=strdup(name);
+  plug->name=(char*)strdup(name);
   if (!plug->name)
     RAISE_MALLOC;
 
@@ -108,7 +108,7 @@ gras_error_t gras_trp_socket_new(int incoming,
 
   if (! (sock=gras_new(gras_socket_t,1)) )
     RAISE_MALLOC;
-  DEBUG1("Create a new socket (%p)", sock);
+  DEBUG1("Create a new socket (%p)", (void*)sock);
 
   sock->plugin = NULL;
   sock->sd     = -1;
@@ -194,7 +194,7 @@ gras_socket_client(const char *host,
   TRY(gras_trp_socket_new(0,&sock));
   sock->plugin= trp;
   sock->peer_port = port;
-  sock->peer_name = strdup(host?host:"localhost");
+  sock->peer_name = (char*)strdup(host?host:"localhost");
 
   /* plugin-specific */
   errcode= (*trp->socket_client)(trp, 
index 7826584..8ed2e02 100644 (file)
@@ -74,7 +74,6 @@ gras_error_t gras_trp_buf_init_sock(gras_socket_t *sock) {
   if (!data)
     RAISE_MALLOC;
   data->in.size  = 0;
-  //  data->buffsize = 32 * 1024 - 4; /* default socket buffsize (32k) - headers */ 
   data->buffsize = 100 * 1024 ; /* 100k */ 
 
   if (!(data->in.data = (char*)gras_malloc(data->buffsize)))
@@ -179,7 +178,7 @@ void gras_trp_buf_socket_close(gras_socket_t *sock){
     free(data->out.data);
   free(data);
 
-  return super->socket_close(sock);
+  super->socket_close(sock);
 }
 
 /**
index e537770..694eed8 100644 (file)
@@ -280,7 +280,7 @@ gras_cfg_unregister(gras_cfg_t *cfg,const char *name) {
 
 gras_error_t
 gras_cfg_register_str(gras_cfg_t *cfg,const char *entry) {
-  char *entrycpy=strdup(entry);
+  char *entrycpy=(char*)strdup(entry);
   char *tok;
 
   int min,max;
@@ -548,7 +548,7 @@ gras_cfg_set_parse(gras_cfg_t *cfg, const char *options) {
   if (!options || !strlen(options)) { /* nothing to do */
     return no_error;
   }
-  optionlist_cpy=strdup(options);
+  optionlist_cpy=(char*)strdup(options);
 
   DEBUG1("List to parse and set:'%s'",options);
   option=optionlist_cpy;
@@ -563,20 +563,20 @@ gras_cfg_set_parse(gras_cfg_t *cfg, const char *options) {
 
     /* Pass the value */
     while (option-name<=(len-1) && *option != ' ' && *option != '\n' && *option != '\t') {
-      //fprintf(stderr,"Take %c.\n",*option);
+      /*fprintf(stderr,"Take %c.\n",*option);*/
       option++;
     }
     if (option-name == len) {
-      //fprintf(stderr,"Boundary=EOL\n");
+      /*fprintf(stderr,"Boundary=EOL\n");*/
       option=NULL; /* don't do next iteration */
 
     } else {
-      //fprintf(stderr,"Boundary on '%c'. len=%d;option-name=%d\n",*option,len,option-name);
+      /*fprintf(stderr,"Boundary on '%c'. len=%d;option-name=%d\n",*option,len,option-name);*/
 
       /* Pass the following blank chars */
       *(option++)='\0';
       while (option-name<(len-1) && (*option == ' ' || *option == '\n' || *option == '\t')) {
-       //      fprintf(stderr,"Ignore a blank char.\n");
+       /*      fprintf(stderr,"Ignore a blank char.\n");*/
        option++;
       }
       if (option-name == len-1)
@@ -741,7 +741,7 @@ gras_error_t
 gras_cfg_set_string(gras_cfg_t *cfg,const char*name, const char*val) { 
   gras_cfgelm_t *cell;
   gras_error_t errcode;
-   char *newval = strdup(val);
+  char *newval = (char*)strdup(val);
 
   VERB2("Configuration setting: %s=%s",name,val);
   TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_string,&cell));
@@ -775,7 +775,7 @@ gras_cfg_set_host(gras_cfg_t *cfg,const char*name,
   VERB3("Configuration setting: %s=%s:%d",name,host,port);
   if (!val)
     RAISE_MALLOC;
-  val->name = strdup(name);
+  val->name = (char*)strdup(name);
   val->port = port;
 
   TRY (gras_cfgelm_get(cfg,name,gras_cfgelm_host,&cell));
index cd98fa7..3657cb0 100644 (file)
@@ -202,7 +202,7 @@ gras_error_t
 gras_dict_dump(gras_dict_t    *dict,
                void_f_pvoid_t *output) {
 
-  printf("Dict %p:\n", dict);
+  printf("Dict %p:\n", (void*)dict);
   return gras_dictelm_dump(dict ? dict->head: NULL, output);
 }
 
index 19e913b..4dfb378 100644 (file)
@@ -31,13 +31,13 @@ struct gras_dict_cursor_ {
   gras_dictelm_t  *head;
 };
 
-static inline
+static _GRAS_INLINE
 gras_error_t
 _cursor_push_keys(gras_dict_cursor_t *p_cursor,
                   gras_dictelm_t        *p_elm);
 
 #undef gras_dict_CURSOR_DEBUG
-//#define gras_dict_CURSOR_DEBUG 1
+/*#define gras_dict_CURSOR_DEBUG 1*/
 
 /**
  * gras_dict_cursor_new:
@@ -93,7 +93,7 @@ gras_dict_cursor_free(gras_dict_cursor_t *p_cursor) {
  *
  * Sanity check to see if the head contains something
  */
-static inline
+static _GRAS_INLINE
 gras_error_t
 __cursor_not_null(gras_dict_cursor_t *p_cursor) {
 
@@ -107,7 +107,7 @@ __cursor_not_null(gras_dict_cursor_t *p_cursor) {
 }
 
 
-static inline
+static _GRAS_INLINE
 gras_error_t
 _cursor_push_keys(gras_dict_cursor_t *p_cursor,
                   gras_dictelm_t        *p_elm) {
@@ -116,7 +116,7 @@ _cursor_push_keys(gras_dict_cursor_t *p_cursor,
   int                  i       = 0;
   static volatile int  count   = 0; /* ??? */
 
-  CDEBUG1(dict_cursor, "Push childs of %p in the cursor", p_elm);
+  CDEBUG1(dict_cursor, "Push childs of %p in the cursor", (void*)p_elm);
 
   if (p_elm->content) {
     TRY(gras_dynar_push(p_cursor->keys,     &p_elm->key    ));
index 498beb6..30317df 100644 (file)
@@ -28,7 +28,7 @@ GRAS_LOG_NEW_SUBCATEGORY(dict_multi,dict,"Dictionaries internals: dictionaries o
 
 /*####[ Private prototypes ]#################################################*/
 
-static inline gras_error_t _gras_dictelm_alloc(char                *key,
+static _GRAS_INLINE gras_error_t _gras_dictelm_alloc(char                *key,
                                               int                  offset,
                                               int                  key_len,
                                               void                *data,
@@ -36,7 +36,7 @@ static inline gras_error_t _gras_dictelm_alloc(char                *key,
                                               /*OUT*/gras_dictelm_t **where);
 static void         _dictelm_wrapper_free(void*);
 
-static inline void  _str_prefix_lgr(const char *key1,
+static _GRAS_INLINE void  _str_prefix_lgr(const char *key1,
                                    int         key_len1,
                                    const char *key2,
                                    int         key_len2,
@@ -66,7 +66,7 @@ static gras_error_t _gras_dictelm_remove_rec(gras_dictelm_t *head,
                                             int             key_len,
                                             int             offset);
 
-static inline
+static _GRAS_INLINE
 void
 _collapse_if_need(gras_dictelm_t *p_head,
                  int             pos,
@@ -74,7 +74,7 @@ _collapse_if_need(gras_dictelm_t *p_head,
 
 /* ---- */
 
-static inline
+static _GRAS_INLINE
 void *
 memdup(const void * const ptr,
        const size_t       length) {
@@ -95,7 +95,7 @@ memdup(const void * const ptr,
  * Change any byte to a printable char
  */
 
-static inline
+static _GRAS_INLINE
 char
 _gras_nibble_to_char(unsigned char c) {
   c &= 0x0f;
@@ -108,7 +108,7 @@ _gras_nibble_to_char(unsigned char c) {
  * Change any byte array to a printable string
  * The length of string_container should at least be data_len*2+1 
  */
-static inline
+static _GRAS_INLINE
 char *
 _gras_bytes_to_string(char * const ptr,
                       int          data_len,
@@ -134,7 +134,7 @@ _gras_bytes_to_string(char * const ptr,
  * Alloc a dict element with no child.
  */
 static 
-inline
+_GRAS_INLINE
 gras_error_t
 _gras_dictelm_alloc(char                *key,
                    int                  key_len,
@@ -225,7 +225,7 @@ _dictelm_wrapper_free(void *pp_elm) {
  * Returns the length of the common prefix of @str1 and @str2.
  * Do make sure the strings are not null
  */
-static inline
+static _GRAS_INLINE
 void
 _str_prefix_lgr(const char *key1,
                int         key_len1,
@@ -283,7 +283,7 @@ _str_prefix_lgr(const char *key1,
  * Compares two dictelm keys and return their matching (using the same 
  * convention than @_gras_dict_child_search() )
  */
-static inline
+static _GRAS_INLINE
 void
 _dict_child_cmp(gras_dictelm_t *p_dict,
                 int          pos,
@@ -348,7 +348,7 @@ _dict_child_cmp(gras_dictelm_t *p_dict,
  *  handled by previous levels of recursion. In output, that the one counting
  *  also this level.                                                         
  */
-static inline
+static _GRAS_INLINE
 void
 _gras_dictelm_child_search(gras_dictelm_t *p_elm,
                           const char  *key,
@@ -403,7 +403,7 @@ _gras_dictelm_child_search(gras_dictelm_t *p_elm,
  *
  * Change the value of the dictelm, making sure to free the old one, if any.
  */
-static inline
+static _GRAS_INLINE
 void
 _gras_dictelm_change_value(gras_dictelm_t    *p_elm,
                           void           *data,
@@ -448,7 +448,7 @@ _gras_dictelm_set_rec(gras_dictelm_t     *p_head,
          key_len, key, 
          ((p_head && p_head->key) ? p_head->key_len : 6),
          ((p_head && p_head->key) ? p_head->key : "(head)"), 
-         offset, p_head);
+         offset, (void*)p_head);
 
   /*** The trivial cases first ***/
 
@@ -476,7 +476,7 @@ _gras_dictelm_set_rec(gras_dictelm_t     *p_head,
       gras_dictelm_t *p_child = NULL;
 
       TRY(_gras_dictelm_alloc(key, key_len, offset, data, free_ctn, &p_child));
-      CDEBUG1(dict_add, "-> Add a child %p", p_child);
+      CDEBUG1(dict_add, "-> Add a child %p", (void*)p_child);
       TRY(gras_dynar_insert_at(p_head->sub, pos, &p_child));
 
       return errcode;
@@ -487,7 +487,7 @@ _gras_dictelm_set_rec(gras_dictelm_t     *p_head,
       gras_dictelm_t *p_child = NULL;
 
       gras_dynar_get(p_head->sub, pos, &p_child);
-      CDEBUG1(dict_add, "-> Change the value of the child %p", p_child);
+      CDEBUG1(dict_add, "-> Change the value of the child %p", (void*)p_child);
       _gras_dictelm_change_value(p_child, data, free_ctn);
 
       free(key);
@@ -500,7 +500,7 @@ _gras_dictelm_set_rec(gras_dictelm_t     *p_head,
       gras_dictelm_t *p_child = NULL;
 
       gras_dynar_get(p_head->sub, pos, &p_child);
-      CDEBUG2(dict_add,"-> Recurse on %p (offset=%d)", p_child, offset);
+      CDEBUG2(dict_add,"-> Recurse on %p (offset=%d)", (void*)p_child, offset);
 
       return _gras_dictelm_set_rec(p_child, key, key_len, 
                                      offset, data, free_ctn);
@@ -515,7 +515,7 @@ _gras_dictelm_set_rec(gras_dictelm_t     *p_head,
       TRY(_gras_dictelm_alloc(key, key_len, old_offset, data, free_ctn, &p_new));
 
       CDEBUG2(dict_add, "-> The child %p become child of new dict (%p)",
-              p_child, p_new);
+              (void*)p_child, (void*)p_new);
 
       TRY(gras_dynar_push(p_new->sub, &p_child));
       p_child->offset = offset;
@@ -541,7 +541,7 @@ _gras_dictelm_set_rec(gras_dictelm_t     *p_head,
                              NULL, NULL, &p_anc));
 
       CDEBUG3(dict_add, "-> Make a common ancestor %p (%.*s)",
-             p_anc, anc_key_len, anc_key);
+             (void*)p_anc, anc_key_len, anc_key);
 
       if (key[offset] < p_child->key[offset]) {
         TRY(gras_dynar_push(p_anc->sub, &p_new));
@@ -649,7 +649,7 @@ _gras_dictelm_get_rec(gras_dictelm_t *p_head,
                      void **data) {
   void *res;
 
-  CDEBUG3(dict_search, "Search %.*s in %p", key_len, key, p_head); 
+  CDEBUG3(dict_search, "Search %.*s in %p", key_len, key, (void*)p_head); 
 
   /*** The trivial case first ***/
 
@@ -664,7 +664,7 @@ _gras_dictelm_get_rec(gras_dictelm_t *p_head,
     int match = 0;
     int pos   = 0;
 
-    *data = NULL; // Make it ready to answer 'not found' in one operation
+    *data = NULL; /* Make it ready to answer 'not found' in one operation */
 
     /*** Search where is the good child, and how good it is ***/
     _gras_dictelm_child_search(p_head, key, key_len, &pos, &offset, &match);
@@ -747,14 +747,14 @@ gras_dictelm_get(gras_dictelm_t    *p_head,
 }
 
 /*----[ _gras_dict_collapse ]------------------------------------------------*/
-static inline
+static _GRAS_INLINE
 void
 _collapse_if_need(gras_dictelm_t *p_head,
                  int             pos,
                  int             offset) {
   gras_dictelm_t  *p_child = NULL;
 
-  CDEBUG2(dict_collapse, "Collapse %d of %p... ", pos, p_head); fflush(stdout);
+  CDEBUG2(dict_collapse, "Collapse %d of %p... ", pos, (void*)p_head);
 
   if (pos >= 0) {
     /* Remove the child if |it's key| == 0 (meaning it's dead) */
@@ -765,7 +765,7 @@ _collapse_if_need(gras_dictelm_t *p_head,
       gras_assert0(gras_dynar_length(p_child->sub) == 0,
                   "Found a dead child with grand childs. Internal error");
 
-      CDEBUG1(dict_collapse, "Remove dead child %p.... ", p_child);
+      CDEBUG1(dict_collapse, "Remove dead child %p.... ", (void*)p_child);
       gras_dynar_remove_at(p_head->sub, pos, &p_child);
     }
   }
@@ -854,7 +854,7 @@ _gras_dictelm_remove_rec(gras_dictelm_t *p_head,
 
         gras_dynar_get(p_head->sub, pos, &p_child);
         /*DEBUG5("Recurse on child %d of %p to remove %.*s (prefix=%d)",
-          pos, p_child, key+offset, key_len-offset,offset);*/
+          pos, (void*)p_child, key+offset, key_len-offset,offset);*/
         TRY(_gras_dictelm_remove_rec(p_child, key, key_len, offset));
 
         _collapse_if_need(p_head, pos, old_offset);
@@ -929,7 +929,7 @@ _gras_dictelm_dump_rec(gras_dictelm_t *p_head,
   if (!p_head)
     return no_error;
 
-  printf("[%p] ", p_head);
+  printf("[%p] ", (void*)p_head);
 
   key     = p_head->key;
   key_len = p_head->key_len;
@@ -1013,6 +1013,6 @@ gras_dictelm_dump(gras_dictelm_t *p_head,
 
 void
 gras_dictelm_print_fct(void *data) {
-  printf("tree %p", data);
+  printf("tree %p", (void*)data);
 }
 
index 2594b5d..1010a37 100644 (file)
@@ -38,17 +38,15 @@ struct gras_dynar_s {
                        (int) (idx), (unsigned long) dynar->used)
 #define __check_populated_dynar(dynar)            \
            gras_assert1(dynar->used,              \
-                       "dynar %p contains nothing",dynar)
+                       "dynar %p contains nothing",(void*)dynar)
 
-
-static inline
-void
-_gras_clear_mem(void * const ptr,
-                const size_t length) {
+static _GRAS_INLINE 
+void _gras_clear_mem(void * const ptr,
+                    const size_t length) {
   memset(ptr, 0, length);
 }
 
-static inline
+static _GRAS_INLINE
 gras_error_t
 _gras_dynar_expand(gras_dynar_t * const dynar,
                    const int            nb) {
@@ -68,7 +66,7 @@ _gras_dynar_expand(gras_dynar_t * const dynar,
     const size_t new_length  = new_size*elmsize;
     char * const new_data    = gras_malloc0(elmsize*new_size);
 
-    DEBUG3("expend %p from %lu to %d elements", dynar, (unsigned long)old_size, nb);
+    DEBUG3("expend %p from %lu to %d elements", (void*)dynar, (unsigned long)old_size, nb);
     if (!new_data)
       RAISE_MALLOC;
 
@@ -87,7 +85,7 @@ _gras_dynar_expand(gras_dynar_t * const dynar,
   return errcode;
 }
 
-static inline
+static _GRAS_INLINE
 void *
 _gras_dynar_elm(const gras_dynar_t * const dynar,
                 const size_t               idx) {
@@ -97,7 +95,7 @@ _gras_dynar_elm(const gras_dynar_t * const dynar,
   return data + idx*elmsize;
 }
 
-static inline
+static _GRAS_INLINE
 void
 _gras_dynar_get_elm(void               * const dst,
                     const gras_dynar_t * const dynar,
@@ -108,7 +106,7 @@ _gras_dynar_get_elm(void               * const dst,
   memcpy(dst, elm, elmsize);
 }
 
-static inline
+static _GRAS_INLINE
 void
 _gras_dynar_put_elm(const gras_dynar_t * const dynar,
                     const size_t               idx,
@@ -184,7 +182,7 @@ gras_dynar_reset(gras_dynar_t * const dynar) {
 
   __sanity_check_dynar(dynar);
 
-  DEBUG1("Reset the dynar %p",dynar);
+  DEBUG1("Reset the dynar %p",(void*)dynar);
   if (dynar->free) {
     gras_dynar_map(dynar, dynar->free);
   }
@@ -420,7 +418,7 @@ gras_dynar_pop(gras_dynar_t * const dynar,
                void         * const dst) {
   __sanity_check_dynar(dynar);
   __check_populated_dynar(dynar);
-  DEBUG1("Pop %p",dynar);
+  DEBUG1("Pop %p",(void*)dynar);
   gras_dynar_remove_at(dynar, dynar->used-1, dst);
 }
 
@@ -499,7 +497,7 @@ gras_dynar_cursor_first(const gras_dynar_t * const dynar,
                        int                * const cursor) {
 
   __sanity_check_dynar(dynar);
-  DEBUG1("Set cursor on %p to the first position",dynar);
+  DEBUG1("Set cursor on %p to the first position",(void*)dynar);
   *cursor = 0;
 }
 
@@ -532,10 +530,10 @@ gras_dynar_cursor_get(const gras_dynar_t * const dynar,
     const int idx = *cursor;
 
     if (idx >= dynar->used) {
-      DEBUG1("Cursor on %p already on last elem",dynar);
+      DEBUG1("Cursor on %p already on last elem",(void*)dynar);
       return FALSE;
     }
-    DEBUG2("Cash out cursor on %p at %d",dynar,idx);
+    DEBUG2("Cash out cursor on %p at %d",(void*)dynar,idx);
 
     _gras_dynar_get_elm(dst, dynar, idx);
   }
index 3b415be..e054e55 100644 (file)
@@ -25,7 +25,7 @@ static void _free_setting(void *s) {
   gras_log_setting_t *set=(gras_log_setting_t*)s;
   if (set) {
     gras_free(set->catname);
-//    free(set); FIXME: uncommenting this leads to segfault when more than one chunk is passed as gras-log
+/*    free(set); FIXME: uncommenting this leads to segfault when more than one chunk is passed as gras-log */
   }
 }
 
@@ -45,6 +45,7 @@ gras_log_category_t _GRAS_LOGV(GRAS_LOG_ROOT_CAT) = {
   "root", gras_log_priority_uninitialized, 0,
   NULL, 0
 };
+
 GRAS_LOG_NEW_SUBCATEGORY(gras,GRAS_LOG_ROOT_CAT,"All GRAS categories");
 GRAS_LOG_NEW_SUBCATEGORY(gros,GRAS_LOG_ROOT_CAT,"All GROS categories (gras toolbox)");
 GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(log,gros,"Loggings from the logging mecanism itself");
@@ -63,7 +64,7 @@ static void _apply_control(gras_log_category_t* cat) {
 
   gras_dynar_foreach(gras_log_settings,cursor,setting) {
     gras_assert0(setting,"Damnit, NULL cat in the list");
-    gras_assert1(setting->catname,"NULL setting(=%p)->catname",setting);
+    gras_assert1(setting->catname,"NULL setting(=%p)->catname",(void*)setting);
 
     if (!strcmp(setting->catname,cat->name)) {
       found = 1;
@@ -137,7 +138,7 @@ void gras_log_parent_set(gras_log_category_t* cat,
   gras_assert0(cat,"NULL category to be given a parent");
   gras_assert1(parent,"The parent category of %s is NULL",cat->name);
 
-  // unlink from current parent
+  /* unlink from current parent */
   if (cat->threshold != gras_log_priority_uninitialized) {
     gras_log_category_t** cpp = &parent->firstChild;
     while(*cpp != cat && *cpp != NULL) {
@@ -147,20 +148,20 @@ void gras_log_parent_set(gras_log_category_t* cat,
     *cpp = cat->nextSibling;
   }
 
-  // Set new parent
+  /* Set new parent */
   cat->parent = parent;
   cat->nextSibling = parent->firstChild;
   parent->firstChild = cat;
 
-  // Make sure parent is initialized
+  /* Make sure parent is initialized */
   if (parent->threshold == gras_log_priority_uninitialized) {
     _cat_init(parent);
   }
     
-  // Reset priority
+  /* Reset priority */
   cat->threshold = parent->threshold;
   cat->isThreshInherited = 1;
-} // log_setParent
+} /* log_setParent */
 
 static void _set_inherited_thresholds(gras_log_category_t* cat) {
   gras_log_category_t* child = cat->firstChild;
@@ -204,7 +205,7 @@ static gras_error_t _gras_log_parse_setting(const char* control_string,
 
   if (!strncmp(dot + 1, "thresh", min(eq - dot - 1,strlen("thresh")))) {
     int i;
-    char *neweq=strdup(eq+1);
+    char *neweq=(char*)strdup(eq+1);
     char *p=neweq-1;
     
     while (*(++p) != '\0') {
@@ -324,7 +325,7 @@ gras_error_t gras_log_control_set(const char* control_string) {
   if (! (set = gras_new(gras_log_setting_t,1)) )
     RAISE_MALLOC;
 
-  if (!(cs=strdup(control_string)))
+  if (!(cs=(char*)strdup(control_string)))
     RAISE_MALLOC;
   _cleanup_double_spaces(cs);
 
@@ -349,7 +350,7 @@ gras_error_t gras_log_control_set(const char* control_string) {
             mismatch_error);
     if (errcode == mismatch_error) {
       DEBUG0("Store for further application");
-      DEBUG1("push %p to the settings",set);
+      DEBUG1("push %p to the settings",(void*)set);
       TRY(gras_dynar_push(gras_log_settings,&set));
       /* malloc in advance the next slot */
       if (!(set = gras_new(gras_log_setting_t,1))) { 
index 3811738..b4e3054 100644 (file)
@@ -38,8 +38,8 @@ static void append_file(gras_log_appender_t* this,
                        gras_log_event_t* ev, 
                        const char *fmt) {
 
-    // TODO: define a format field in struct for timestamp, etc.
-    //    struct DefaultLogAppender* this = (struct DefaultLogAppender*)this0;
+  /* TODO: define a format field in struct for timestamp, etc.
+     struct DefaultLogAppender* this = (struct DefaultLogAppender*)this0;*/
     
     if ((FILE*)(this->appender_data) == NULL)
       this->appender_data = (void*)stderr;