From: Arnaud Giersch Date: Sat, 11 Feb 2023 07:01:49 +0000 (+0100) Subject: Use more readable alternatives for string::compare(). X-Git-Tag: v3.34~554 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/730305cbe236b9f3d5781ec05d20e730ac6452ff Use more readable alternatives for string::compare(). --- diff --git a/src/plugins/file_system/s4u_FileSystem.cpp b/src/plugins/file_system/s4u_FileSystem.cpp index ec92efb987..929cf17441 100644 --- a/src/plugins/file_system/s4u_FileSystem.cpp +++ b/src/plugins/file_system/s4u_FileSystem.cpp @@ -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>* content = nullptr; content = local_disk_->extension()->get_content(); if (content) { diff --git a/src/xbt/xbt_replay.cpp b/src/xbt/xbt_replay.cpp index 2b9a52dad4..d58bab1efc 100644 --- a/src/xbt/xbt_replay.cpp +++ b/src/xbt/xbt_replay.cpp @@ -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);