diff --git a/packages/seacas/libraries/ioss/src/exodus/Ioex_Utils.C b/packages/seacas/libraries/ioss/src/exodus/Ioex_Utils.C index fb5379b8b3..972e5b4c19 100644 --- a/packages/seacas/libraries/ioss/src/exodus/Ioex_Utils.C +++ b/packages/seacas/libraries/ioss/src/exodus/Ioex_Utils.C @@ -18,11 +18,11 @@ #include namespace { - size_t match(const char *name1, const char *name2) + size_t match(const std::string &name1, const std::string &name2) { - size_t l1 = std::strlen(name1); - size_t l2 = std::strlen(name2); - size_t len = l1 < l2 ? l1 : l2; + size_t l1 = name1.size(); + size_t l2 = name2.size(); + size_t len = std::min(l1, l2); for (size_t i = 0; i < len; i++) { if (name1[i] != name2[i]) { while (i > 0 && (isdigit(name1[i - 1]) != 0) && (isdigit(name2[i - 1]) != 0)) { @@ -35,11 +35,6 @@ namespace { return len; } - size_t match(const std::string &name1, const std::string &name2) - { - return match(name1.c_str(), name2.c_str()); - } - template void internal_write_coordinate_frames(int exoid, const Ioss::CoordinateFrameContainer &frames, INT /*dummy*/) diff --git a/packages/seacas/libraries/ioss/src/exonull/Ioexnl_Utils.C b/packages/seacas/libraries/ioss/src/exonull/Ioexnl_Utils.C index 871b913cdf..0c7af15061 100644 --- a/packages/seacas/libraries/ioss/src/exonull/Ioexnl_Utils.C +++ b/packages/seacas/libraries/ioss/src/exonull/Ioexnl_Utils.C @@ -19,11 +19,11 @@ #include namespace { - size_t match(const char *name1, const char *name2) + size_t match(const std::string &name1, const std::string &name2) { - size_t l1 = std::strlen(name1); - size_t l2 = std::strlen(name2); - size_t len = l1 < l2 ? l1 : l2; + size_t l1 = name1.size(); + size_t l2 = name2.size(); + size_t len = std::min(l1, l2); for (size_t i = 0; i < len; i++) { if (name1[i] != name2[i]) { while (i > 0 && (isdigit(name1[i - 1]) != 0) && (isdigit(name2[i - 1]) != 0)) { @@ -384,14 +384,14 @@ namespace Ioexnl { // VECTOR_3D). If found, it returns the name. // - static const std::string &displace = "displacement"; + static const std::string displace = "displacement"; size_t max_span = 0; for (const auto &name : fields) { std::string lc_name(name); Ioss::Utils::fixup_name(lc_name); - size_t span = match(lc_name.c_str(), displace.c_str()); + size_t span = match(lc_name, displace); if (span > max_span) { const Ioss::VariableType *var_type = block->get_field(name).transformed_storage(); int comp_count = var_type->component_count();