Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Remove useless commented lines of code.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 4 Apr 2019 09:32:19 +0000 (11:32 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 4 Apr 2019 09:53:33 +0000 (11:53 +0200)
examples/s4u/app-bittorrent/s4u-peer.hpp
include/simgrid/simix/blocking_simcall.hpp
include/xbt/dynar.h
include/xbt/graph.h
src/smpi/include/smpi_keyvals.hpp
src/xbt/automaton/automatonparse_promela.c
src/xbt/mmalloc/mfree.c
src/xbt/mmalloc/mm_module.c
src/xbt/mmalloc/mmalloc.c
src/xbt/mmalloc/mrealloc.c

index 2d9eb6a..2737649 100644 (file)
@@ -15,7 +15,6 @@ public:
   int id; // Peer id
   simgrid::s4u::Mailbox* mailbox_;
   unsigned int bitfield = 0U; // Fields
-  //  int messages_count;
   double peer_speed    = 0;
   double last_unchoke  = 0;
   int current_piece    = -1;
index 0a927ce..43565d3 100644 (file)
@@ -71,8 +71,8 @@ template <class F> auto kernel_sync(F code) -> decltype(code().get())
 }
 
 /** A blocking (`wait()`-based) future for SIMIX processes */
-// TODO, .wait_for()
-// TODO, .wait_until()
+// TODO, .wait_for
+// TODO, .wait_until
 // TODO, SharedFuture
 // TODO, simgrid::simix::when_all - wait for all future to be ready (this one is simple!)
 // TODO, simgrid::simix::when_any - wait for any future to be ready
index 5384cfb..63d2b18 100644 (file)
@@ -210,11 +210,8 @@ static inline int _xbt_dynar_cursor_get(const xbt_dynar_t dynar, unsigned int id
   if (!dynar) /* iterating over a NULL dynar is a no-op */
     return 0;
 
-  if (idx >= dynar->used) {
-    //XBT_DEBUG("Cursor on %p already on last elem", (void *) dynar);
+  if (idx >= dynar->used)
     return 0;
-  }
-  //  XBT_DEBUG("Cash out cursor on %p at %u", (void *) dynar, *idx);
 
   memcpy(dst, ((char *) dynar->data) + idx * dynar->elmsize, dynar->elmsize);
 
index 50eeb68..98e7661 100644 (file)
@@ -23,7 +23,6 @@ typedef struct xbt_graph *xbt_graph_t;
 
 /* Node structure */
 /* Be careful of what you do with this structure */
-/* typedef struct xbt_node *xbt_node_t; */
 typedef struct xbt_node {
   xbt_dynar_t out;
   xbt_dynar_t in;               /* not used when the graph is directed */
@@ -34,7 +33,6 @@ typedef struct xbt_node {
 
 /* edge structure */
 /* Be careful of what you do with this structure */
-/* typedef struct xbt_edge *xbt_edge_t; */
 typedef struct xbt_edge {
   xbt_node_t src;
   xbt_node_t dst;
@@ -43,7 +41,6 @@ typedef struct xbt_edge {
 
 /* Graph structure */
 /* Be careful of what you do with this structure */
-/* typedef struct xbt_graph *xbt_graph_t; */
 typedef struct xbt_graph {
   xbt_dynar_t nodes;
   xbt_dynar_t edges;
index dc7dd35..a23be10 100644 (file)
@@ -158,7 +158,7 @@ template <typename T> void Keyval::cleanup_attr(){
           call_deleter<T>((T*)this, elem, it.first,it.second,&flag);
         }
       } else {
-        //already deleted, not a problem;
+        // already deleted, not a problem
         flag=0;
       }
     }
index e43df85..104630c 100644 (file)
@@ -56,7 +56,6 @@ static void new_transition(char* id, xbt_automaton_exp_label_t label)
   xbt_automaton_state_t state_dst = xbt_automaton_state_exists(parsed_automaton, id);
   xbt_automaton_state_t state_src = xbt_automaton_state_exists(parsed_automaton, state_id_src);
 
-  //xbt_transition_t trans = NULL;
   xbt_automaton_transition_new(parsed_automaton, state_src, state_dst, label);
 
 }
index 6a95aa3..e08aba3 100644 (file)
@@ -24,8 +24,6 @@ void mfree(struct mdesc *mdp, void *ptr)
   size_t i;
   int it;
 
-//  fprintf(stderr,"free(%p)\n",ptr);
-
   if (ptr == NULL)
     return;
 
@@ -93,7 +91,6 @@ void mfree(struct mdesc *mdp, void *ptr)
 
       block = i;
     } else {
-      //fprintf(stderr,"Free block %d to %d (as a new chunck)\n",block,block+mdp->heapinfo[block].busy_block.size);
       /* Really link this block back into the free list.  */
       mdp->heapinfo[block].free_block.size = mdp->heapinfo[block].busy_block.size;
       mdp->heapinfo[block].free_block.next = mdp->heapinfo[i].free_block.next;
@@ -126,7 +123,8 @@ void mfree(struct mdesc *mdp, void *ptr)
     }
 
     /* Now see if we can return stuff to the system.  */
-    /*    blocks = mdp -> heapinfo[block].free.size;
+#if 0
+          blocks = mdp -> heapinfo[block].free.size;
           if (blocks >= FINAL_FREE_BLOCKS && block + blocks == mdp -> heaplimit
           && mdp -> morecore (mdp, 0) == ADDRESS (block + blocks))
           {
@@ -140,7 +138,8 @@ void mfree(struct mdesc *mdp, void *ptr)
           block = mdp -> heapinfo[block].free.prev;
           mdp -> heapstats.chunks_free--;
           mdp -> heapstats.bytes_free -= bytes;
-          } */
+          }
+#endif
 
     /* Set the next search to begin at this block.
        This is probably important to the trick where realloc returns the block to
@@ -174,7 +173,6 @@ void mfree(struct mdesc *mdp, void *ptr)
     mdp->heapinfo[block].busy_frag.frag_size[frag_nb] = -1;
     mdp->heapinfo[block].busy_frag.ignore[frag_nb] = 0;
 
-//    fprintf(stderr,"nfree:%zu capa:%d\n", mdp->heapinfo[block].busy_frag.nfree,(BLOCKSIZE >> type));
     if (mdp->heapinfo[block].busy_frag.nfree ==
         (BLOCKSIZE >> type) - 1) {
       /* If all fragments of this block are free, remove this block from its swag and free the whole block.  */
index 32aadda..825d992 100644 (file)
@@ -332,7 +332,7 @@ void mmalloc_postexit(void)
 {
   /* Do not destroy the default mdp or ldl won't be able to free the memory it
    * allocated since we're in memory */
-  // xbt_mheap_destroy_no_free(__mmalloc_default_mdp);
+  // xbt_mheap_destroy_no_free(__mmalloc_default_mdp)
 }
 
 // This is the underlying implementation of mmalloc_get_bytes_used_remote.
index 46da29a..5294d69 100644 (file)
@@ -197,8 +197,6 @@ void *mmalloc_no_memset(xbt_mheap_t mdp, size_t size)
   if (size < SMALLEST_POSSIBLE_MALLOC)
     size = SMALLEST_POSSIBLE_MALLOC;
 
-  //  printf("(%s) Mallocing %d bytes on %p (default: %p)...",xbt_thread_self_name(),size,mdp,__mmalloc_default_mdp);fflush(stdout);
-
   if (!(mdp->flags & MMALLOC_INITIALIZED))
     initialize(mdp);
 
@@ -345,7 +343,6 @@ void *mmalloc_no_memset(xbt_mheap_t mdp, size_t size)
     mdp -> heapstats.bytes_free -= blocks * BLOCKSIZE;
 
   }
-  //printf("(%s) Done mallocing. Result is %p\n",xbt_thread_self_name(),result);fflush(stdout);
 
   return (result);
 }
index 89360df..2d3c1ce 100644 (file)
@@ -35,8 +35,6 @@ void *mrealloc(xbt_mheap_t mdp, void *ptr, size_t size)
     return mmalloc(mdp, size);
   }
 
-  //printf("(%s)realloc %p to %d...",xbt_thread_self_name(),ptr,(int)size);
-
   if ((char *) ptr < (char *) mdp->heapbase || BLOCK(ptr) > mdp->heapsize) {
     printf("FIXME. Ouch, this pointer is not mine, refusing to proceed (another solution would be to malloc "
            "it instead of reallocing it, see source code)\n");
@@ -83,7 +81,6 @@ void *mrealloc(xbt_mheap_t mdp, void *ptr, size_t size)
     if (blocks < mdp->heapinfo[block].busy_block.size) {
       int it;
       /* The new size is smaller; return excess memory to the free list. */
-      //printf("(%s) return excess memory...",xbt_thread_self_name());
       for (it= block+blocks; it< mdp->heapinfo[block].busy_block.size ; it++){
         mdp->heapinfo[it].type = MMALLOC_TYPE_UNFRAGMENTED; // FIXME that should be useless, type should already be 0 here
         mdp->heapinfo[it].busy_block.ignore = 0;
@@ -119,7 +116,6 @@ void *mrealloc(xbt_mheap_t mdp, void *ptr, size_t size)
       mdp->heaplimit = oldlimit;
 
       result = mmalloc_no_memset(mdp, requested_size);
-      //fprintf(stderr,"remalloc(%zu)~>%p\n",requested_size,result);
 
       if (ptr != result)
         memmove(result, ptr, blocks * BLOCKSIZE);
@@ -136,7 +132,6 @@ void *mrealloc(xbt_mheap_t mdp, void *ptr, size_t size)
 
     if (size > (size_t) (1 << (type - 1)) && size <= (size_t) (1 << type)) {
       /* The new size is the same kind of fragment.  */
-      //printf("(%s) new size is same kind of fragment...",xbt_thread_self_name());
 
       result = ptr;
       int frag_nb = RESIDUAL(result, BLOCKSIZE) >> type;
@@ -146,7 +141,6 @@ void *mrealloc(xbt_mheap_t mdp, void *ptr, size_t size)
     } else { /* fragment -> Either other fragment, or block */
       /* The new size is different; allocate a new space,
          and copy the lesser of the new size and the old. */
-      //printf("(%s) new size is different...",xbt_thread_self_name());
 
       result = mmalloc(mdp, requested_size);
 
@@ -155,6 +149,5 @@ void *mrealloc(xbt_mheap_t mdp, void *ptr, size_t size)
     }
     break;
   }
-  //printf("(%s) Done reallocing: %p\n",xbt_thread_self_name(),result);fflush(stdout);
   return (result);
 }