Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill a useless function
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 28 Aug 2016 15:58:43 +0000 (17:58 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 28 Aug 2016 15:58:43 +0000 (17:58 +0200)
src/include/surf/surf.h
src/simix/smx_vm.cpp
src/surf/surf_c_bindings.cpp

index 6b20c10..eb14203 100644 (file)
@@ -254,13 +254,6 @@ XBT_PUBLIC(sg_size_t) surf_host_get_free_size(sg_host_t resource, const char* na
  */
 XBT_PUBLIC(sg_size_t) surf_host_get_used_size(sg_host_t resource, const char* name);
 
-/**
- * @brief Destroy a VM
- *
- * @param resource The surf vm
- */
-XBT_PUBLIC(void) surf_vm_destroy(sg_host_t resource);
-
 /** @brief Suspend a VM */
 XBT_PUBLIC(void) surf_vm_suspend(sg_host_t resource);
 
index 3e50aca..b560598 100644 (file)
@@ -338,14 +338,12 @@ void simcall_HANDLER_vm_shutdown(smx_simcall_t simcall, sg_host_t ind_vm)
 void SIMIX_vm_destroy(sg_host_t vm)
 {
   /* this code basically performs a similar thing like SIMIX_host_destroy() */
-
-  const char *hostname = sg_host_get_name(vm);
-
-  XBT_DEBUG("destroy %s", hostname);
+  XBT_DEBUG("destroy %s", sg_host_get_name(vm));
 
   /* this will call the registered callback function, i.e., SIMIX_host_destroy().  */
   sg_host_simix_destroy(vm);
 
-  /* jump to vm_ws_destroy(). The surf level resource will be freed. */
-  surf_vm_destroy(vm);
+  /* Don't free these things twice: they are the ones of my physical host */
+  vm->pimpl_cpu = nullptr;
+  vm->pimpl_netcard = nullptr;
 }
index 74ade32..aba8480 100644 (file)
@@ -229,11 +229,6 @@ int surf_host_file_move(sg_host_t host, surf_file_t fd, const char* fullpath){
   return get_casted_host(host)->fileMove(fd, fullpath);
 }
 
-void surf_vm_destroy(sg_host_t vm){ // FIXME:DEADCODE
-  vm->pimpl_cpu = nullptr;
-  vm->pimpl_netcard = nullptr;
-}
-
 void surf_vm_suspend(sg_host_t vm){
   get_casted_vm(vm)->suspend();
 }