Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Do not use offsetof() in mc_snapshot_get_heap_end
authorGabriel Corona <gabriel.corona@loria.fr>
Tue, 17 Jun 2014 14:44:42 +0000 (16:44 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Tue, 17 Jun 2014 14:44:42 +0000 (16:44 +0200)
We don't need this. It's much clearer like this.

src/mc/mc_private.h

index ea4746a..8362de9 100644 (file)
@@ -672,7 +672,7 @@ uint64_t mc_hash_processes_state(int num_state, xbt_dynar_t stacks);
 inline static void* mc_snapshot_get_heap_end(mc_snapshot_t snapshot) {
   if(snapshot==NULL)
       xbt_die("snapshot is NULL");
 inline static void* mc_snapshot_get_heap_end(mc_snapshot_t snapshot) {
   if(snapshot==NULL)
       xbt_die("snapshot is NULL");
-  char* addr = (char*) std_heap + offsetof(struct mdesc, breakval);
+  void** addr = &((xbt_mheap_t)std_heap)->breakval;
   return mc_snapshot_read_pointer(addr, snapshot);
 }
 
   return mc_snapshot_read_pointer(addr, snapshot);
 }