diff options
author | Josh Stone <jistone@redhat.com> | 2009-05-15 15:22:05 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-05-15 15:22:05 -0700 |
commit | 0d3ea790a5ee17df1600ccb377fbeeb9f5574642 (patch) | |
tree | 7b78ef2c1a3aa1c62d7b0957a64ad63e14cbe49f | |
parent | 1adf8ef1ca448709a7a4527b916d65ada0b3fc04 (diff) | |
download | systemtap-steved-0d3ea790a5ee17df1600ccb377fbeeb9f5574642.tar.gz systemtap-steved-0d3ea790a5ee17df1600ccb377fbeeb9f5574642.tar.xz systemtap-steved-0d3ea790a5ee17df1600ccb377fbeeb9f5574642.zip |
Simplify our unordered_map typedefs
-rw-r--r-- | dwflpp.cxx | 5 | ||||
-rw-r--r-- | dwflpp.h | 22 |
2 files changed, 9 insertions, 18 deletions
@@ -27,11 +27,6 @@ #include <deque> #include <iostream> #include <map> -#ifdef HAVE_TR1_UNORDERED_MAP -#include <tr1/unordered_map> -#else -#include <ext/hash_map> -#endif #include <set> #include <sstream> #include <stdexcept> @@ -23,12 +23,6 @@ #include <string> #include <vector> -#ifdef HAVE_TR1_UNORDERED_MAP -#include <tr1/unordered_map> -#else -#include <ext/hash_map> -#endif - extern "C" { #include <elfutils/libdwfl.h> } @@ -44,18 +38,20 @@ enum line_t { ABSOLUTE, RELATIVE, RANGE, WILDCARD }; enum info_status { info_unknown, info_present, info_absent }; #ifdef HAVE_TR1_UNORDERED_MAP -typedef std::tr1::unordered_map<std::string,Dwarf_Die> cu_function_cache_t; -typedef std::tr1::unordered_map<std::string,cu_function_cache_t*> mod_cu_function_cache_t; // module:cu -> function -> die +#include <tr1/unordered_map> +template<class T> struct stap_map { + typedef std::tr1::unordered_map<std::string, T> type; +}; #else -struct stringhash { - // __gnu_cxx:: is needed because our own hash.h has an ambiguous hash<> decl too. +#include <ext/hash_map> +template<class T> struct stap_map { + typedef __gnu_cxx::hash_map<std::string, T, stap_map> type; size_t operator() (const std::string& s) const { __gnu_cxx::hash<const char*> h; return h(s.c_str()); } }; - -typedef __gnu_cxx::hash_map<std::string,Dwarf_Die,stringhash> cu_function_cache_t; -typedef __gnu_cxx::hash_map<std::string,cu_function_cache_t*,stringhash> mod_cu_function_cache_t; // module:cu -> function -> die #endif +typedef stap_map<Dwarf_Die>::type cu_function_cache_t; // function -> die +typedef stap_map<cu_function_cache_t*>::type mod_cu_function_cache_t; // module:cu -> function -> die typedef std::vector<func_info> func_info_map_t; typedef std::vector<inline_instance_info> inline_instance_map_t; |