Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename variable hiding others.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 21 Feb 2012 20:43:49 +0000 (21:43 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 22 Feb 2012 07:10:23 +0000 (08:10 +0100)
src/amok/Bandwidth/bandwidth.c
src/xbt/mmalloc/mm_module.c

index 6e917ce..d5fb441 100644 (file)
@@ -371,7 +371,7 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t ctx, void *payload)
   }
 
   while (tooshort) {
-    void *payload;
+    void *payloadgot;
     int msggot;
     TRY {
       xbt_socket_meas_recv(measIn, 120, request->msg_size,
@@ -385,7 +385,7 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t ctx, void *payload)
       /* FIXME: tell error to remote ? */
       RETHROWF("Error encountered while receiving the experiment: %s");
     }
-    gras_msg_wait_or(60, msgtwaited, &ctx_reask, &msggot, &payload);
+    gras_msg_wait_or(60, msgtwaited, &ctx_reask, &msggot, &payloadgot);
     switch (msggot) {
     case 0:                    /* BW stop */
       tooshort = 0;
@@ -393,7 +393,7 @@ int amok_bw_cb_bw_handshake(gras_msg_cb_ctx_t ctx, void *payload)
     case 1:                    /* BW reask */
       tooshort = 1;
       free(request);
-      request = (bw_request_t) payload;
+      request = (bw_request_t) payloadgot;
       XBT_VERB("Return the reasking RPC");
       gras_msg_rpcreturn(60, ctx_reask, NULL);
     }
index 5cb6084..8bbed93 100644 (file)
@@ -83,63 +83,63 @@ xbt_mheap_t xbt_mheap_new(int fd, void *baseaddr)
       return (NULL);
 
     else if (sbuf.st_size > 0) {
-       /* We were given an valid file descriptor on an open file, so try to remap
-          it into the current process at the same address to which it was previously
-          mapped. It naturally have to pass some sanity checks for that.
-
-          Note that we have to update the file descriptor number in the malloc-
-          descriptor read from the file to match the current valid one, before
-          trying to map the file in, and again after a successful mapping and
-          after we've switched over to using the mapped in malloc descriptor
-          rather than the temporary one on the stack.
-
-          Once we've switched over to using the mapped in malloc descriptor, we
-          have to update the pointer to the morecore function, since it almost
-          certainly will be at a different address if the process reusing the
-          mapped region is from a different executable.
-
-          Also note that if the heap being remapped previously used the mmcheckf()
-          routines, we need to update the hooks since their target functions
-          will have certainly moved if the executable has changed in any way.
-          We do this by calling mmcheckf() internally.
-
-          Returns a pointer to the malloc descriptor if successful, or NULL if
-          unsuccessful for some reason. */
-
-         struct mdesc mtemp;
-         struct mdesc *mdp = NULL, *mdptemp = NULL;
-
-         if (lseek(fd, 0L, SEEK_SET) != 0)
-           return NULL;
-         if (read(fd, (char *) &mtemp, sizeof(mtemp)) != sizeof(mtemp))
-           return NULL;
-         if (mtemp.headersize != sizeof(mtemp))
-           return NULL;
-         if (strcmp(mtemp.magic, MMALLOC_MAGIC) != 0)
-           return NULL;
-         if (mtemp.version > MMALLOC_VERSION)
-           return NULL;
-
-         mtemp.fd = fd;
-         if (__mmalloc_remap_core(&mtemp) == mtemp.base) {
-           mdp = (struct mdesc *) mtemp.base;
-           mdp->fd = fd;
-           if(!mdp->refcount){
-              sem_init(&mdp->sem, 0, 1);
-             mdp->refcount++;
-           }
-         }
-
-         /* Add the new heap to the linked list of heaps attached by mmalloc */
-         mdptemp = __mmalloc_default_mdp;
-         while(mdptemp->next_mdesc)
-           mdptemp = mdptemp->next_mdesc;
-
-         LOCK(mdptemp);
-           mdptemp->next_mdesc = mdp;
-         UNLOCK(mdptemp);
-
-         return (mdp);
+      /* We were given an valid file descriptor on an open file, so try to remap
+        it into the current process at the same address to which it was previously
+        mapped. It naturally have to pass some sanity checks for that.
+
+        Note that we have to update the file descriptor number in the malloc-
+        descriptor read from the file to match the current valid one, before
+        trying to map the file in, and again after a successful mapping and
+        after we've switched over to using the mapped in malloc descriptor
+        rather than the temporary one on the stack.
+
+        Once we've switched over to using the mapped in malloc descriptor, we
+        have to update the pointer to the morecore function, since it almost
+        certainly will be at a different address if the process reusing the
+        mapped region is from a different executable.
+
+        Also note that if the heap being remapped previously used the mmcheckf()
+        routines, we need to update the hooks since their target functions
+        will have certainly moved if the executable has changed in any way.
+        We do this by calling mmcheckf() internally.
+
+        Returns a pointer to the malloc descriptor if successful, or NULL if
+        unsuccessful for some reason. */
+
+      struct mdesc newmd;
+      struct mdesc *mdptr = NULL, *mdptemp = NULL;
+
+      if (lseek(fd, 0L, SEEK_SET) != 0)
+       return NULL;
+      if (read(fd, (char *) &newmd, sizeof(newmd)) != sizeof(newmd))
+       return NULL;
+      if (newmd.headersize != sizeof(newmd))
+       return NULL;
+      if (strcmp(newmd.magic, MMALLOC_MAGIC) != 0)
+       return NULL;
+      if (newmd.version > MMALLOC_VERSION)
+       return NULL;
+
+      newmd.fd = fd;
+      if (__mmalloc_remap_core(&newmd) == newmd.base) {
+       mdptr = (struct mdesc *) newmd.base;
+       mdptr->fd = fd;
+       if(!mdptr->refcount){
+         sem_init(&mdptr->sem, 0, 1);
+         mdptr->refcount++;
+       }
+      }
+
+      /* Add the new heap to the linked list of heaps attached by mmalloc */
+      mdptemp = __mmalloc_default_mdp;
+      while(mdptemp->next_mdesc)
+       mdptemp = mdptemp->next_mdesc;
+
+      LOCK(mdptemp);
+      mdptemp->next_mdesc = mdptr;
+      UNLOCK(mdptemp);
+
+      return mdptr;
     }
   }
 
@@ -249,9 +249,7 @@ void *xbt_mheap_destroy(xbt_mheap_t mdp)
     /* Now unmap all the pages associated with this region by asking for a
        negative increment equal to the current size of the region. */
 
-    if ((mmorecore(&mtemp,
-                        (char *) mtemp.base - (char *) mtemp.breakval)) ==
-        NULL) {
+    if (mmorecore(&mtemp, (char *)mtemp.base - (char *)mtemp.breakval) == NULL) {
       /* Deallocating failed.  Update the original malloc descriptor
          with any changes */
       *mdp = mtemp;