Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use more readable alternatives for string::compare().
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sat, 11 Feb 2023 07:01:49 +0000 (08:01 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sat, 11 Feb 2023 10:02:06 +0000 (11:02 +0100)
src/plugins/file_system/s4u_FileSystem.cpp
src/xbt/xbt_replay.cpp

index ec92efb..929cf17 100644 (file)
@@ -247,7 +247,7 @@ sg_size_t File::tell() const
 void File::move(const std::string& fullpath) const
 {
   /* Check if the new full path is on the same mount point */
-  if (fullpath.compare(0, mount_point_.length(), mount_point_) == 0) {
+  if (fullpath.rfind(mount_point_, 0) == 0) {
     std::map<std::string, sg_size_t, std::less<>>* content = nullptr;
     content = local_disk_->extension<FileSystemDiskExt>()->get_content();
     if (content) {
index 2b9a52d..d58bab1 100644 (file)
@@ -128,7 +128,7 @@ int replay_runner(const char* actor_name, const char* trace_filename)
     simgrid::xbt::ReplayAction evt;
     simgrid::xbt::ReplayReader reader(trace_filename);
     while (reader.get(&evt)) {
-      if (evt.front().compare(actor_name) == 0) {
+      if (evt.front() == actor_name) {
         simgrid::xbt::handle_action(evt);
       } else {
         XBT_WARN("Ignore trace element not for me (target='%s', I am '%s')", evt.front().c_str(), actor_name);