From 0d3ea790a5ee17df1600ccb377fbeeb9f5574642 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Fri, 15 May 2009 15:22:05 -0700 Subject: Simplify our unordered_map typedefs --- dwflpp.cxx | 5 ----- dwflpp.h | 22 +++++++++------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/dwflpp.cxx b/dwflpp.cxx index c7dfc5a0..6f75c0a4 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -27,11 +27,6 @@ #include #include #include -#ifdef HAVE_TR1_UNORDERED_MAP -#include -#else -#include -#endif #include #include #include diff --git a/dwflpp.h b/dwflpp.h index 649d241b..970855f8 100644 --- a/dwflpp.h +++ b/dwflpp.h @@ -23,12 +23,6 @@ #include #include -#ifdef HAVE_TR1_UNORDERED_MAP -#include -#else -#include -#endif - extern "C" { #include } @@ -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 cu_function_cache_t; -typedef std::tr1::unordered_map mod_cu_function_cache_t; // module:cu -> function -> die +#include +template struct stap_map { + typedef std::tr1::unordered_map type; +}; #else -struct stringhash { - // __gnu_cxx:: is needed because our own hash.h has an ambiguous hash<> decl too. +#include +template struct stap_map { + typedef __gnu_cxx::hash_map type; size_t operator() (const std::string& s) const { __gnu_cxx::hash h; return h(s.c_str()); } }; - -typedef __gnu_cxx::hash_map cu_function_cache_t; -typedef __gnu_cxx::hash_map mod_cu_function_cache_t; // module:cu -> function -> die #endif +typedef stap_map::type cu_function_cache_t; // function -> die +typedef stap_map::type mod_cu_function_cache_t; // module:cu -> function -> die typedef std::vector func_info_map_t; typedef std::vector inline_instance_map_t; -- cgit