diff -r b826f13c260e -r 7a11f9e9e703 util/dsymtable.cc --- a/util/dsymtable.cc Wed Sep 07 19:28:10 2011 +0200 +++ b/util/dsymtable.cc Thu Sep 08 20:25:00 2011 +0200 @@ -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; }