about summary refs log tree commit diff stats
path: root/cpp/003trace.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-05-04 11:02:56 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-05-04 11:02:56 -0700
commita66c9ae68122e04637d65c7f3aedcd96012c8cb6 (patch)
treeceddf9f22c55621be86768a0aeedc927495e62d6 /cpp/003trace.cc
parentde49fb426aa44984d308f5856ec836360ba0bdce (diff)
downloadmu-a66c9ae68122e04637d65c7f3aedcd96012c8cb6.tar.gz
1249 - new type: index_t
It will always be identical to size_t, just more readable, like
recipe_number, etc. The various unsigned types are sizes, indices (which
often compare with sizes for bounds checking), numbers which are
canonical elements of a specific space (like recipes or mu types), and
ids which I haven't introduced yet.
Diffstat (limited to 'cpp/003trace.cc')
-rw-r--r--cpp/003trace.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/cpp/003trace.cc b/cpp/003trace.cc
index 5a275154..77d51fc4 100644
--- a/cpp/003trace.cc
+++ b/cpp/003trace.cc
@@ -214,7 +214,7 @@ void trace_all(const string& label, const list<string>& in) {
 
 bool check_trace_contents(string FUNCTION, string FILE, int LINE, string expected) {  // missing layer == anywhere, frame, hierarchical layers
   vector<string> expected_lines = split(expected, "");
-  size_t curr_expected_line = 0;
+  index_t curr_expected_line = 0;
   while (curr_expected_line < expected_lines.size() && expected_lines[curr_expected_line].empty())
     ++curr_expected_line;
   if (curr_expected_line == expected_lines.size()) return true;
@@ -252,7 +252,7 @@ void parse_layer_frame_contents(const string& orig, string* layer, string* frame
 }
 
 void parse_contents(const string& s, const string& delim, string* prefix, string* contents) {
-  string::size_type pos = s.find(delim);
+  index_t pos = s.find(delim);
   if (pos == NOT_FOUND) {
     *prefix = "";
     *contents = s;
@@ -264,7 +264,7 @@ void parse_contents(const string& s, const string& delim, string* prefix, string
 }
 
 void parse_layer_and_frame(const string& orig, string* layer, string* frame) {
-  size_t last_slash = orig.rfind('/');
+  index_t last_slash = orig.rfind('/');
   if (last_slash == NOT_FOUND
       || orig.find_last_not_of("0123456789") != last_slash) {
     *layer = orig;
@@ -280,7 +280,7 @@ void parse_layer_and_frame(const string& orig, string* layer, string* frame) {
 
 bool check_trace_contents(string FUNCTION, string FILE, int LINE, string layer, string expected) {  // empty layer == everything, multiple layers, hierarchical layers
   vector<string> expected_lines = split(expected, "");
-  size_t curr_expected_line = 0;
+  index_t curr_expected_line = 0;
   while (curr_expected_line < expected_lines.size() && expected_lines[curr_expected_line].empty())
     ++curr_expected_line;
   if (curr_expected_line == expected_lines.size()) return true;
@@ -379,7 +379,7 @@ struct lease_trace_frame {
 
 bool check_trace_contents(string FUNCTION, string FILE, int LINE, string layer, int frame, string expected) {  // multiple layers, hierarchical layers
   vector<string> expected_lines = split(expected, "");  // hack: doesn't handle newlines in embedded in lines
-  size_t curr_expected_line = 0;
+  index_t curr_expected_line = 0;
   while (curr_expected_line < expected_lines.size() && expected_lines[curr_expected_line].empty())
     ++curr_expected_line;
   if (curr_expected_line == expected_lines.size()) return true;
@@ -411,7 +411,7 @@ bool check_trace_contents(string FUNCTION, string FILE, int LINE, string layer,
 
 vector<string> split(string s, string delim) {
   vector<string> result;
-  string::size_type begin=0, end=s.find(delim);
+  index_t begin=0, end=s.find(delim);
   while (true) {
     if (end == NOT_FOUND) {
       result.push_back(string(s, begin, NOT_FOUND));