Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Better fix to the comparison between signed and unsigned int around dynar size: chang...
[simgrid.git] / src / gras / DataDesc / ddt_parse.c
index b3dfefb..3adaccf 100644 (file)
@@ -204,7 +204,7 @@ static void add_free_f(xbt_dynar_t dynar,void_f_pvoid_t free_f) {
 
   XBT_IN;
   xbt_dynar_pop(dynar,&former);
-  memcpy(former.type->extra,&free_f, sizeof(free_f));
+  memcpy(former.type->extra,free_f, sizeof(free_f));
   xbt_dynar_push(dynar,&former);
   XBT_OUT;
 }
@@ -474,10 +474,10 @@ static void parse_statement(char   *definition,
           if (!storage)
             PARSE_ERROR1("value for free_f annotation of field %s is not a known constant",identifier.name);
           if (identifier.tm.is_matrix == -1) {
-             add_free_f(identifiers,*(void_f_pvoid_t**)storage);
+             add_free_f(identifiers,*(void_f_pvoid_t*)storage);
              identifier.tm.is_matrix = 0;
           } else if (identifier.tm.is_dynar == -1) {
-             add_free_f(identifiers,*(void_f_pvoid_t**)storage);
+             add_free_f(identifiers,*(void_f_pvoid_t*)storage);
              identifier.tm.is_dynar = 0;
           } else {       
              PARSE_ERROR1("free_f annotation only accepted for dynars and matrices which subtype is already declared (field %s)",
@@ -559,7 +559,7 @@ static gras_datadesc_type_t parse_struct(char *definition) {
 
   xbt_dynar_t identifiers;
   s_identifier_t field;
-  int i;
+  unsigned int iter;
   int done;
 
   xbt_dynar_t fields_to_push;
@@ -600,7 +600,7 @@ static gras_datadesc_type_t parse_struct(char *definition) {
     
     DEBUG1("This statement contained %lu identifiers",xbt_dynar_length(identifiers));
     /* append the identifiers we've found */
-    xbt_dynar_foreach(identifiers,i, field) {
+    xbt_dynar_foreach(identifiers,iter, field) {
       if (field.tm.is_ref)
        PARSE_ERROR2("Not enough GRAS_ANNOTATE to deal with all dereferencing levels of %s (%d '*' left)",
                     field.name,field.tm.is_ref);
@@ -615,7 +615,7 @@ static gras_datadesc_type_t parse_struct(char *definition) {
     DEBUG1("struct_type=%p",(void*)struct_type);
     
     /* Make sure that all fields declaring a size push it into the cbps */
-    xbt_dynar_foreach(fields_to_push,i, name) {
+    xbt_dynar_foreach(fields_to_push,iter, name) {
       DEBUG1("struct_type=%p",(void*)struct_type);
       if (name[0] == '*') {
        VERB2("Push field '%s' as a multiplier into size stack of %p",
@@ -748,5 +748,5 @@ void gras_datadesc_set_const(const char*name, int value) {
   int *stored = xbt_new(int, 1);
   *stored=value;
 
-  xbt_dict_set(gras_dd_constants,name, stored, free); 
+  xbt_dict_set(gras_dd_constants,name, stored, xbt_free_f); 
 }