# # add_file "hash_map.hh" # # patch "hash_map.hh" # from [] # to [70ec673ffc3af0f40bd3379dbb93b52296cff714] # # patch "interner.hh" # from [31d3f27219df930763472894aa9bc653f533c077] # to [56755be621a718730f8e1d3963d102b72eb272c3] # # patch "xdelta.cc" # from [f6ca886b245cd540d6b8a0dc24b285a0d6530592] # to [3e050716dffea184cd8145b71686a902cbfd461a] # ======================================================================== --- hash_map.hh +++ hash_map.hh 70ec673ffc3af0f40bd3379dbb93b52296cff714 @@ -0,0 +1,54 @@ +#ifndef __HASHMAP_HH +#define __HASHMAP_HH + +#include + +#ifdef HAVE_GNUCXX_HASHMAP +#define HASHMAP_PRESENT +#include +#include + +namespace hashmap { + using __gnu_cxx::hash_map; + + struct string_hash + { + size_t operator()(std::string const & s) const + { + return __gnu_cxx::__stl_hash_string(s.c_str()); + } + }; + + +} +#endif + +#ifdef HAVE_STLPORT_HASHMAP +#define HASHMAP_PRESENT +#include +#include + +namespace hashmap { + using std::hash_map; + + struct string_hash + { + size_t operator()(std::string const & s) const + { + const char* s2=s.c_str(); + unsigned long h = 0; + for ( ; *s2; ++s2) + h = 5*h + *s2; + return size_t(h); + } + }; +} +#endif + +#ifndef HASHMAP_PRESENT +#error need wrapper for hash_map for your compiler +#endif + +#undef HASHMAP_PRESENT + +#endif ======================================================================== --- interner.hh 31d3f27219df930763472894aa9bc653f533c077 +++ interner.hh 56755be621a718730f8e1d3963d102b72eb272c3 @@ -7,18 +7,10 @@ // see the file COPYING for details #include -#include +#include "hash_map.hh" #include "sanity.hh" -struct string_hash -{ - size_t operator()(std::string const & s) const - { - return __gnu_cxx::__stl_hash_string(s.c_str()); - } -}; - struct string_eq { bool operator()(std::string const & a, @@ -32,8 +24,8 @@ struct interner { - typedef typename __gnu_cxx::hash_map hmap; hmap fwd; ======================================================================== --- xdelta.cc f6ca886b245cd540d6b8a0dc24b285a0d6530592 +++ xdelta.cc 3e050716dffea184cd8145b71686a902cbfd461a @@ -20,7 +20,6 @@ // if you want to *read* a patch, you will like unidiff format much better. // take a look in diff_patch.(cc|hh) for a nice interface to that. -#include #include #include #include @@ -31,16 +30,16 @@ #include #include "adler32.hh" +#include "hash_map.hh" #include "numeric_vocab.hh" #include "sanity.hh" #include "xdelta.hh" using namespace std; -using namespace __gnu_cxx; struct identity {size_t operator()(u32 const & v) const { return static_cast(v);}}; typedef pair extent; -typedef hash_map match_table; +typedef hashmap::hash_map match_table; struct insn