diff -r ba80c3ceb6fb -r 2c3c4dc34979 util/dsymtable.cc --- a/util/dsymtable.cc Mon Jul 11 09:47:27 2011 +0100 +++ b/util/dsymtable.cc Fri Jul 29 16:03:28 2011 +0100 @@ -91,6 +91,28 @@ #endif + +/* Determine how many entries are associated to key identifier_str */ +/* returns: + * 0: if no entry is found + * 1: if 1 entry is found + * 2: if more than 1 entry is found + */ +template +int dsymtable_c::multiplicity(const char *identifier_str) { + iterator lower = _base.lower_bound(identifier_str); + if (lower == _base.end()) return 0; + + iterator upper = _base.upper_bound(identifier_str); + iterator second = lower; + second++; + + if (second == upper) return 1; + + return 2; +} + + /* returns null_value if not found! */ template value_type dsymtable_c::find_value(const char *identifier_str) { @@ -104,11 +126,11 @@ template -value_type dsymtable_c::find_value(const symbol_c *symbol) { +const char * dsymtable_c::symbol_to_string(const symbol_c *symbol) { const token_c *name = dynamic_cast(symbol); if (name == NULL) ERROR; - return find_value(name->value); + return name->value; }