Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Constify pointer and reference local variables in src/kernel/.
[simgrid.git] / src / kernel / context / ContextUnix.cpp
index fba49bf..3cacf6d 100644 (file)
@@ -91,10 +91,10 @@ UContext::UContext(std::function<void()>&& code, actor::ActorImpl* actor, Swappe
 
 void UContext::swap_into(SwappedContext* to_)
 {
-  UContext* to = static_cast<UContext*>(to_);
+  const UContext* to = static_cast<UContext*>(to_);
   ASAN_ONLY(void* fake_stack = nullptr);
-  ASAN_ONLY(to->asan_ctx_ = this);
-  ASAN_START_SWITCH(this->asan_stop_ ? nullptr : &fake_stack, to->asan_stack_, to->asan_stack_size_);
+  ASAN_ONLY(to_->asan_ctx_ = this);
+  ASAN_START_SWITCH(this->asan_stop_ ? nullptr : &fake_stack, to_->asan_stack_, to_->asan_stack_size_);
   swapcontext(&this->uc_, &to->uc_);
   ASAN_FINISH_SWITCH(fake_stack, &this->asan_ctx_->asan_stack_, &this->asan_ctx_->asan_stack_size_);
 }