The unified diff between revisions [d1a2aa71..] and [9b06d7a6..] is displayed below. It can also be downloaded as a raw diff.
#
#
# patch "tokens.hh"
# from [82fa198956699b46f811dc957ac4e6d4b5e81cdc]
# to [ae9d9d87c06dddb9997b1fb4869b4c296c437c82]
#
# patch "tokens_test.cc"
# from [eb5c84ef6fef06ba3584d8cee17150ccb494831d]
# to [7a4d4f8cc9898703a87e8445b797e65f46e1ea74]
#
============================================================
--- tokens.hh 82fa198956699b46f811dc957ac4e6d4b5e81cdc
+++ tokens.hh ae9d9d87c06dddb9997b1fb4869b4c296c437c82
@@ -39,11 +39,11 @@ class Tokens {
}
token_t add(const T &add) {
- T our_copy = add;
token_t tid;
- tid = token_to_id[our_copy];
+ tid = token_to_id[add];
if (tid == 0) {
+ T our_copy = add;
tid = token_to_id[our_copy] = ++last_id;
id_to_token[tid] = our_copy;
}
============================================================
--- tokens_test.cc eb5c84ef6fef06ba3584d8cee17150ccb494831d
+++ tokens_test.cc 7a4d4f8cc9898703a87e8445b797e65f46e1ea74
@@ -23,14 +23,20 @@ input_test (Tokens<std::string, string_h
}
}
-int
-main (int argc, char *argv[])
+void
+test (void)
{
Tokens<std::string, string_hash<std::string> > t;
string_test (t);
input_test (t);
t.playback ();
+}
+
+int
+main (int argc, char *argv[])
+{
+ test ();
return 0;
}