aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetIOScalar/src
diff options
context:
space:
mode:
authorschnetter <>2004-08-05 08:28:00 +0000
committerschnetter <>2004-08-05 08:28:00 +0000
commita8551e6ed3a57d98a5fbae015783c9ea9a381fb1 (patch)
tree1cb82ff697eae9ce6c4c239ac15c2879ae36dc69 /Carpet/CarpetIOScalar/src
parentd53be2bd2aac4d954bbafddca77c8b50e2dbfee4 (diff)
Use C++ string iterators instead of walking through a C string by
Use C++ string iterators instead of walking through a C string by hand. darcs-hash:20040805082825-07bb3-92ba29174f67ea15c78a136828a651101255bf47.gz
Diffstat (limited to 'Carpet/CarpetIOScalar/src')
-rw-r--r--Carpet/CarpetIOScalar/src/ioscalar.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/Carpet/CarpetIOScalar/src/ioscalar.cc b/Carpet/CarpetIOScalar/src/ioscalar.cc
index ca31e93ce..83b450bb5 100644
--- a/Carpet/CarpetIOScalar/src/ioscalar.cc
+++ b/Carpet/CarpetIOScalar/src/ioscalar.cc
@@ -18,7 +18,7 @@
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOScalar/src/ioscalar.cc,v 1.5 2004/06/21 16:07:41 schnetter Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOScalar/src/ioscalar.cc,v 1.6 2004/08/05 10:28:25 schnetter Exp $";
CCTK_FILEVERSION(Carpet_CarpetIOScalar_ioscalar_cc);
}
@@ -211,13 +211,14 @@ namespace CarpetIOScalar {
// Find the set of desired reductions
list<info> reductions;
- char const * p = outScalar_reductions;
- while (*p) {
- while (*p && isspace(*p)) ++p;
- if (!*p) break;
- char const * const start = p;
- while (*p && !isspace(*p)) ++p;
- char const * const end = p;
+ string const redlist (outScalar_reductions);
+ string::const_iterator p = redlist.begin();
+ while (p!=redlist.end()) {
+ while (p!=redlist.end() && isspace(*p)) ++p;
+ if (p==redlist.end()) break;
+ string::const_iterator const start = p;
+ while (p!=redlist.end() && !isspace(*p)) ++p;
+ string::const_iterator const end = p;
string const reduction (start, end);
int const handle = CCTK_ReductionHandle (reduction.c_str());
if (handle < 0) {