From c569004dfb6a4386a8b9845053f6daac25f1634b Mon Sep 17 00:00:00 2001 From: Christian Heinrich Date: Thu, 16 Jun 2016 15:22:43 +0200 Subject: [PATCH] [SMPI/MC] Use std::strlen() instead of manual counting. --- src/mc/mc_checkpoint.cpp | 4 ++-- src/smpi/smpi_bench.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mc/mc_checkpoint.cpp b/src/mc/mc_checkpoint.cpp index 20754d3f1e..d6e234cf4e 100644 --- a/src/mc/mc_checkpoint.cpp +++ b/src/mc/mc_checkpoint.cpp @@ -527,7 +527,7 @@ static std::vector get_current_fds(pid_t pid) // We don't handle them. // It does not mean we should silently ignore them however. - if (strncmp(link, "pipe:", 5) == 0 || strncmp(link, "socket:", 7) == 0) + if (strncmp(link, "pipe:", std::strlen("pipe:")) == 0 || strncmp(link, "socket:", std::strlen("socket:")) == 0) continue; // If dot_output enabled, do not handle the corresponding file @@ -541,7 +541,7 @@ static std::vector get_current_fds(pid_t pid) } // This is probably a shared memory used by lttng-ust: - if(strncmp("/dev/shm/ust-shm-tmp-", link, 21)==0) + if(strncmp("/dev/shm/ust-shm-tmp-", link, std::strlen("/dev/shm/ust-shm-tmp-"))==0) continue; // Add an entry for this FD in the snapshot: diff --git a/src/smpi/smpi_bench.cpp b/src/smpi/smpi_bench.cpp index e6998c378f..2aa1b815b2 100644 --- a/src/smpi/smpi_bench.cpp +++ b/src/smpi/smpi_bench.cpp @@ -646,7 +646,7 @@ void smpi_really_switch_data_segment(int dest) { int smpi_is_privatisation_file(char* file) { - return strncmp("/dev/shm/my-buffer-", file, 19) == 0; + return strncmp("/dev/shm/my-buffer-", file, std::strlen("/dev/shm/my-buffer-")) == 0; } void smpi_initialize_global_memory_segments(){ -- 2.20.1