Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
This, modify the declaration of type of function pointer. It also clear the warnings...
authorcherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 22 Oct 2007 08:37:06 +0000 (08:37 +0000)
committercherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 22 Oct 2007 08:37:06 +0000 (08:37 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@4837 48e7efb5-ca39-0410-a469-dd3cf9ba447f

17 files changed:
include/xbt/dynar.h
include/xbt/matrix.h
src/amok/PeerManagement/peermanagement.c
src/gras/DataDesc/ddt_create.c
src/gras/Virtu/process.c
src/gras/Virtu/sg_emul.c
src/gras/gras.c
src/surf/surf.c
src/xbt/config.c
src/xbt/cunit.c
src/xbt/dict_multi.c
src/xbt/dynar.c
src/xbt/graph.c
src/xbt/heap.c
src/xbt/mallocator.c
src/xbt/xbt_matrix.c
src/xbt/xbt_str.c

index 5bb68dc..74aed4e 100644 (file)
@@ -83,10 +83,10 @@ SG_BEGIN_DECL()
  *  @{
  */
 
-  XBT_PUBLIC(void) xbt_dynar_get_cpy(const xbt_dynar_t dynar, const int idx, void * const dst);
+  XBT_PUBLIC(void) xbt_dynar_get_cpy(const xbt_dynar_t dynar, const unsigned long idx, void * const dst);
   
   XBT_PUBLIC(void) xbt_dynar_set(xbt_dynar_t dynar, const int idx, const void *src);
-  XBT_PUBLIC(void) xbt_dynar_replace(xbt_dynar_t dynar, const int idx, const void *object);
+  XBT_PUBLIC(void) xbt_dynar_replace(xbt_dynar_t dynar, const unsigned long idx, const void *object);
 
   XBT_PUBLIC(void) xbt_dynar_insert_at(xbt_dynar_t  const dynar, const int  idx, const void *src);
   XBT_PUBLIC(void) xbt_dynar_remove_at(xbt_dynar_t  const dynar, const int  idx, void * const dst);
@@ -115,7 +115,7 @@ SG_BEGIN_DECL()
  *  @{
  */
 
-  XBT_PUBLIC(void*) xbt_dynar_get_ptr(const xbt_dynar_t dynar, const int idx);
+  XBT_PUBLIC(void*) xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long idx);
   XBT_PUBLIC(void*) xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar, const int idx);
   XBT_PUBLIC(void*) xbt_dynar_push_ptr(xbt_dynar_t  const dynar);
   XBT_PUBLIC(void*) xbt_dynar_pop_ptr(xbt_dynar_t  const dynar);
index 9a4742a..a224fa1 100644 (file)
@@ -45,9 +45,9 @@ XBT_PUBLIC(void) xbt_matrix_free(xbt_matrix_t matrix);
 XBT_PUBLIC(void) xbt_matrix_free_voidp(void *d);
 
 XBT_PUBLIC(void) xbt_matrix_copy_values(xbt_matrix_t dest, xbt_matrix_t src,
-                           int lsize, int rsize,
-                           int lpos_dst,int rpos_dst,
-                           int lpos_src,int rpos_src,
+                           unsigned int lsize, unsigned int rsize,
+                           unsigned int lpos_dst,unsigned int rpos_dst,
+                           unsigned int lpos_src,unsigned int rpos_src,
                            pvoid_f_pvoid_t const cpy_f);
 
 XBT_PUBLIC(void) xbt_matrix_dump(xbt_matrix_t matrix, const char *name, int coords,
index f0ed25e..3eb0164 100644 (file)
@@ -265,7 +265,7 @@ static void _amok_pm_leave(void *p) {
 
 void amok_pm_modulecreate() {
   gras_module_add("amok_pm", sizeof(s_amok_pm_moddata_t), &amok_pm_moddata_id,
-                 &_amok_pm_init,&_amok_pm_exit,&_amok_pm_join,&_amok_pm_leave);
+                 _amok_pm_init,_amok_pm_exit,_amok_pm_join,_amok_pm_leave);
 }
 
 
index 446a3a9..0495574 100644 (file)
@@ -43,7 +43,7 @@ static gras_datadesc_type_t gras_ddt_new(const char *name) {
   res->cycle = 0;
       
   xbt_set_add(gras_datadesc_set_local,
-              (xbt_set_elm_t)res,&gras_ddt_freev);
+              (xbt_set_elm_t)res,gras_ddt_freev);
   XBT_OUT;
   return res;
 }
@@ -177,7 +177,7 @@ gras_datadesc_type_t
   res->category_code = e_gras_datadesc_type_cat_struct;
   res->category.struct_data.fields = 
        xbt_dynar_new(sizeof(gras_dd_cat_field_t),
-                     &gras_dd_cat_field_free);
+                     gras_dd_cat_field_free);
 
   XBT_OUT;
   return res;
@@ -320,7 +320,7 @@ gras_datadesc_type_t
   res->category_code           = e_gras_datadesc_type_cat_union;
   res->category.union_data.fields =
      xbt_dynar_new(sizeof(gras_dd_cat_field_t*),
-                   &gras_dd_cat_field_free);
+                   gras_dd_cat_field_free);
   res->category.union_data.selector = selector;
 
   return res;
index b87a118..0e1050d 100644 (file)
@@ -144,7 +144,7 @@ gras_procdata_init() {
       THROW1(unknown_error,0,"MayDay: two modules use '%s' as libdata name", fab.name);
     
     /* Add the data in place, after some more sanity checking */
-    elem = (*fab.constructor)();
+    elem = (*(fab.constructor))();
     if (elem->name_len && elem->name_len != strlen(elem->name)) {
        elem->name_len = strlen(elem->name);
        WARN1("Module '%s' constructor is borken: it does not set elem->name_len",
index e44614f..1f4305e 100644 (file)
@@ -26,7 +26,7 @@ static double reference = .00000000523066250047108838; /* FIXME: we should bench
 static double duration = 0.0;
 
 static char* locbuf = NULL;
-static int locbufsize;
+static unsigned int locbufsize;
 
 void gras_emul_init(void)
 {
index 9314a25..63f1d6c 100644 (file)
@@ -52,7 +52,7 @@ void gras_init(int *argc,char **argv) {
        gras_msg_procdata_t msg_pd;
   VERB0("Initialize GRAS");
 
-  xbt_getpid = &gras_os_getpid;
+  xbt_getpid = gras_os_getpid;
   /* First initialize the XBT */
   xbt_init(argc,argv);
    
index 8880069..92c0864 100644 (file)
@@ -357,7 +357,7 @@ FILE *surf_fopen(const char *name, const char *mode)
   int i;
   char *path = NULL;
   FILE *file = NULL;
-  int path_name_len = 0;       /* don't count '\0' */
+  unsigned int path_name_len = 0;      /* don't count '\0' */
 
   xbt_assert0(name, "Need a non-NULL file name");
 
index a640310..6411ad5 100644 (file)
@@ -239,11 +239,11 @@ xbt_cfg_register(xbt_cfg_t cfg,
     break;
 
   case xbt_cfgelm_string:
-   res->content = xbt_dynar_new(sizeof(char*),&xbt_cfg_str_free);
+   res->content = xbt_dynar_new(sizeof(char*),xbt_cfg_str_free);
    break;
 
   case xbt_cfgelm_peer:
-   res->content = xbt_dynar_new(sizeof(xbt_peer_t),&xbt_peer_free_voidp);
+   res->content = xbt_dynar_new(sizeof(xbt_peer_t),xbt_peer_free_voidp);
    break;
 
   default:
index e507d22..182217c 100644 (file)
@@ -141,7 +141,7 @@ xbt_test_suite_t xbt_test_suite_new(const char *name, const char *fmt, ...) {
   va_list ap;
 
   if (!_xbt_test_suites) 
-    _xbt_test_suites = xbt_dynar_new(sizeof(xbt_test_suite_t),&xbt_test_suite_free);
+    _xbt_test_suites = xbt_dynar_new(sizeof(xbt_test_suite_t),xbt_test_suite_free);
 
   va_start(ap, fmt);
   vasprintf(&suite->title,fmt, ap);
index a80a226..d7863ed 100644 (file)
@@ -87,7 +87,7 @@ xbt_multidict_set(xbt_dict_t  mdict,
                   xbt_dynar_t keys,
                   void       *data,  void_f_pvoid_t free_ctn) {
   xbt_dynar_t lens = xbt_dynar_new(sizeof(unsigned long int),NULL);
-  int i;
+  unsigned long i;
   xbt_ex_t e;
 
   for (i = 0; i < xbt_dynar_length(keys); i++) {
@@ -154,7 +154,7 @@ xbt_multidict_get_ext(xbt_dict_t  mdict,
 void *
 xbt_multidict_get(xbt_dict_t mdict, xbt_dynar_t keys) {
   xbt_dynar_t lens = xbt_dynar_new(sizeof(unsigned long int),NULL);
-  int i;
+  unsigned long i;
   void *res;
   
   for (i = 0; i < xbt_dynar_length(keys); i++) {
@@ -225,7 +225,7 @@ xbt_multidict_remove(xbt_dict_t mdict, xbt_dynar_t keys) {
 
   xbt_ex_t e;
   xbt_dynar_t lens = xbt_dynar_new(sizeof(unsigned long int),NULL);
-  int i;
+  unsigned long i;
       
   for (i = 0; i < xbt_dynar_length(keys); i++) {
     char *thiskey = xbt_dynar_get_as(keys, i, char*);
index 6abfd76..d558710 100644 (file)
@@ -65,7 +65,7 @@ void _xbt_clear_mem(void * const ptr,
 static XBT_INLINE
 void
 _xbt_dynar_expand(xbt_dynar_t const dynar,
-                   const int          nb) {
+                   const unsigned long          nb) {
   const unsigned long old_size    = dynar->size;
 
   if (nb > old_size) {
@@ -130,7 +130,7 @@ _xbt_dynar_put_elm(const xbt_dynar_t  dynar,
 static XBT_INLINE 
 void
 _xbt_dynar_remove_at(xbt_dynar_t  const dynar,
-                     const int            idx,
+                     const unsigned long            idx,
                      void         * const object) {
 
   unsigned long nb_shift;
@@ -278,7 +278,7 @@ xbt_dynar_reset(xbt_dynar_t const dynar) {
  * array is not expanded and nothing is done.
  */
 void xbt_dynar_shrink(xbt_dynar_t dynar, int empty_slots_wanted) {
-  int size_wanted;
+  unsigned long size_wanted;
    
   _dynar_lock(dynar);
 
@@ -326,7 +326,7 @@ xbt_dynar_length(const xbt_dynar_t dynar) {
  */
 void
 xbt_dynar_get_cpy(const xbt_dynar_t dynar,
-                  const int          idx,
+                  const unsigned long         idx,
                   void       * const dst) {
   _dynar_lock(dynar);
   _sanity_check_dynar(dynar);
@@ -347,7 +347,7 @@ xbt_dynar_get_cpy(const xbt_dynar_t dynar,
  * Make a copy before fooling with it.
  */
 void*
-xbt_dynar_get_ptr(const xbt_dynar_t dynar, const int idx) {
+xbt_dynar_get_ptr(const xbt_dynar_t dynar, const unsigned long idx) {
 
   void *res;
   _dynar_lock(dynar);
@@ -363,7 +363,7 @@ xbt_dynar_get_ptr(const xbt_dynar_t dynar, const int idx) {
 
 static void XBT_INLINE /* not synchronized */
 _xbt_dynar_set(xbt_dynar_t         dynar,
-               const int            idx,
+               const unsigned long   idx,
                const void   * const src) {
 
   _sanity_check_dynar(dynar);
@@ -408,7 +408,7 @@ xbt_dynar_set(xbt_dynar_t         dynar,
  */
 void
 xbt_dynar_replace(xbt_dynar_t         dynar,
-                  const int            idx,
+                  const unsigned long       idx,
                   const void   * const object) {
   _dynar_lock(dynar);
   _sanity_check_dynar(dynar);
@@ -417,7 +417,7 @@ xbt_dynar_replace(xbt_dynar_t         dynar,
   if (idx < dynar->used && dynar->free_f) {
     void * const old_object = _xbt_dynar_elm(dynar, idx);
 
-    dynar->free_f(old_object);
+    (*(dynar->free_f))(old_object);
   }
 
   _xbt_dynar_set(dynar, idx, object);
@@ -426,7 +426,7 @@ xbt_dynar_replace(xbt_dynar_t         dynar,
 
 static XBT_INLINE void *
 _xbt_dynar_insert_at_ptr(xbt_dynar_t const dynar,
-                       const int            idx) {
+                       const unsigned long            idx) {
    void *res;
    unsigned long old_used;
    unsigned long new_used;
@@ -514,7 +514,7 @@ xbt_dynar_remove_at(xbt_dynar_t  const dynar,
 int
 xbt_dynar_search(xbt_dynar_t  const dynar,
                 void        *const elem) {
-  int it;
+  unsigned long it;
   
   _dynar_lock(dynar);
   for (it=0; it< dynar->used; it++) 
@@ -624,7 +624,7 @@ static void _dynar_map(const xbt_dynar_t  dynar,
 
   for (i = 0; i < used; i++) {
     _xbt_dynar_get_elm(elm, dynar, i);
-    op(elm);
+    (*op)(elm);
   }
 }
 
@@ -639,7 +639,7 @@ static void _dynar_map(const xbt_dynar_t  dynar,
  */
 void
 xbt_dynar_map(const xbt_dynar_t  dynar,
-               void_f_pvoid_t    const op) {
+               void_f_pvoid_t     const op) {
 
   _dynar_lock(dynar);
   _sanity_check_dynar(dynar);
@@ -688,7 +688,7 @@ _xbt_dynar_cursor_get(const xbt_dynar_t dynar,
   _sanity_check_dynar(dynar);
   {
 
-    const int idx = *cursor;
+    const unsigned long idx = *cursor;
 
     if (idx >= dynar->used) {
       DEBUG1("Cursor on %p already on last elem",(void*)dynar);
index 1237288..27910e5 100644 (file)
@@ -169,7 +169,7 @@ void xbt_graph_free_node(xbt_graph_t g, xbt_node_t n,
                         void_f_pvoid_t edge_free_function)
 {
   unsigned long nbr;
-  int i;
+  unsigned long i;
   int cursor = 0;
   xbt_node_t node = NULL;
   xbt_edge_t edge = NULL;
@@ -292,7 +292,7 @@ double *xbt_graph_get_length_matrix(xbt_graph_t g)
 {
   int cursor = 0;
   int in_cursor = 0;
-  int idx, i;
+  unsigned long idx, i;
   unsigned long n;
   xbt_edge_t edge = NULL;
   xbt_node_t node = NULL;
@@ -340,7 +340,7 @@ double *xbt_graph_get_length_matrix(xbt_graph_t g)
 void xbt_floyd_algorithm(xbt_graph_t g, double *adj, double *d,
                         xbt_node_t * p)
 {
-  int i, j, k;
+  unsigned long i, j, k;
   unsigned long n;
   n = xbt_dynar_length(g->nodes);
 
@@ -384,7 +384,7 @@ xbt_node_t *xbt_graph_shortest_paths(xbt_graph_t g)
 {
   xbt_node_t *p;
   xbt_node_t *r;
-  int i, j, k;
+  unsigned long i, j, k;
   unsigned long n;
 
   double *adj = NULL;
@@ -620,7 +620,7 @@ xbt_graph_t xbt_graph_read(const char *filename,
   ETag_graphxml_edge_fun = __parse_edge;
 
   xbt_graph_parse_open(filename);
-  xbt_assert1((!xbt_graph_parse()), "Parse error in %s", filename);
+  xbt_assert1((!(*xbt_graph_parse)()), "Parse error in %s", filename);
   xbt_graph_parse_close();
 
   graph = parsed_graph;
index 747b2e3..243e9c3 100644 (file)
@@ -45,7 +45,7 @@ void xbt_heap_free(xbt_heap_t H)
   int i;
   if (H->free)
     for (i = 0; i < H->count; i++)
-      (*H->free)(H->items[i].content);
+      (*(H->free))(H->items[i].content);
   free(H->items);
   free(H);
   return;
index b678466..fcf4bc2 100644 (file)
@@ -65,7 +65,7 @@ void xbt_mallocator_free(xbt_mallocator_t m) {
 
 
   for (i = 0; i < m->current_size; i++) {
-    m->free_f(m->objects[i]);
+    (*(m->free_f))(m->objects[i]);
   }
   xbt_free(m->objects);
   xbt_free(m);
@@ -98,9 +98,9 @@ void *xbt_mallocator_get(xbt_mallocator_t m) {
   }
   else {
     /* otherwise we must allocate a new object */
-    object = m->new_f();
+    object = (*(m->new_f))();
   }
-  m->reset_f(object);
+  (*(m->reset_f))(object);
   return object;
 }
 
@@ -126,6 +126,6 @@ void xbt_mallocator_release(xbt_mallocator_t m, void *object) {
   }
   else {
     /* otherwise we don't have a choice, we must free the object */
-    m->free_f(object);
+    (*(m->free_f))(object);
   }
 }
index b644d3b..53ac040 100644 (file)
@@ -41,7 +41,7 @@ xbt_matrix_t xbt_matrix_new_sub(xbt_matrix_t from,
 
 /** \brief destructor */
 void xbt_matrix_free(xbt_matrix_t mat) {
-  int i;
+  unsigned int i;
   if (mat) {
     if (mat->free_f) {
       for (i=0; i < (mat->lines * mat->rows) ; i++) {
@@ -63,7 +63,7 @@ void xbt_matrix_free_voidp(void *d) {
  *  \param coords: boolean indicating whether we should add the coords of each cell to the output*/
 void xbt_matrix_dump(xbt_matrix_t matrix, const char*name, int coords,
                     void_f_pvoid_t display_fun) {
-  int i,j;
+  unsigned int i,j;
 
   fprintf(stderr,">>> Matrix %s dump (%d x %d)\n",name,matrix->lines,matrix->rows);
   for (i=0; i<matrix->lines; i++) {
@@ -94,11 +94,11 @@ void xbt_matrix_dump_display_double(void*d) {
  * \param rpos_src: row offset on destination matrix
  */
 void xbt_matrix_copy_values(xbt_matrix_t dst, xbt_matrix_t src,
-                           int lsize, int rsize,
-                           int lpos_dst,int rpos_dst,
-                           int lpos_src,int rpos_src,
+                           unsigned int lsize, unsigned int rsize,
+                           unsigned int lpos_dst,unsigned int rpos_dst,
+                           unsigned int lpos_src,unsigned int rpos_src,
                            pvoid_f_pvoid_t const cpy_f) {
-   int i,j;
+   unsigned int i,j;
    
    DEBUG10("Copy a %dx%d submatrix from %dx%d(of %dx%d) to %dx%d (of %dx%d)",
           lsize,rsize,
@@ -179,7 +179,7 @@ xbt_matrix_t xbt_matrix_double_new_mult(xbt_matrix_t A,xbt_matrix_t B) {
 /** \brief add to C the result of A*B */
 void xbt_matrix_double_addmult(xbt_matrix_t A,xbt_matrix_t B,
                       /*OUT*/ xbt_matrix_t C) {
-  int i,j,k;
+  unsigned int i,j,k;
 
   xbt_assert2(A->lines == C->lines,
              "A->lines != C->lines (%d vs %d)",A->lines,C->lines);
index 2ca23ab..02ee5ab 100644 (file)
@@ -412,7 +412,8 @@ char *xbt_str_join(xbt_dynar_t dyn, const char*sep) {
  */
 long getline(char **buf, size_t *n, FILE *stream) {
    
-   int i, ch;
+   size_t i;
+   int ch;
    
    if (!*buf) {
      *buf = xbt_malloc(512);
@@ -452,7 +453,7 @@ long getline(char **buf, size_t *n, FILE *stream) {
 static xbt_matrix_t diff_build_LCS(xbt_dynar_t da, xbt_dynar_t db) {
   xbt_matrix_t C = xbt_matrix_new(xbt_dynar_length(da),xbt_dynar_length(db),
                                  sizeof(int),NULL); 
-  int i,j;
+  unsigned long i,j;
 
   /* Compute the LCS */
   /*