diff options
author | Timo Weingärtner <timo@tiwe.de> | 2013-04-23 18:28:33 +0200 |
---|---|---|
committer | Timo Weingärtner <timo@tiwe.de> | 2013-04-23 18:28:33 +0200 |
commit | 9d0562d22cef95b0db1af30e199a371670ca8050 (patch) | |
tree | 5312b89f87cbd28f674eb2bd46153da35e7dad28 /inode.h | |
parent | fb3fe1b085b30fcc9defa8f29477226806db085b (diff) | |
download | hadori-9d0562d22cef95b0db1af30e199a371670ca8050.tar.gz |
remove hashing stuff
the cases in which that gave a speedup are rare to nonexistent
Diffstat (limited to 'inode.h')
-rw-r--r-- | inode.h | 27 |
1 files changed, 2 insertions, 25 deletions
@@ -25,39 +25,16 @@ #include <sys/stat.h> #include <sys/types.h> -#include <zlib.h> - -class inode { -public: +struct inode { std::string const filename; struct stat const stat; -protected: - uLong mutable adler; - -public: inode (std::string const &, struct stat const); - uLong get_adler () const; - friend bool compare (inode const &, inode const &); friend std::ostream& operator<< (std::ostream&, inode const &); }; -inline inode::inode (std::string const & __filename, struct stat const __stat) : filename(__filename), stat(__stat), adler(-1) { -} - -inline uLong inode::get_adler () const { - if (adler == uLong(-1)) { - char buffer[1 << 14]; - std::ifstream f(filename.c_str()); - - adler = adler32(0L, Z_NULL, 0); - while (not f.eof()) { - f.read(buffer, sizeof(buffer)); - adler = adler32(adler, (Bytef *) buffer, f.gcount()); - } - } - return adler; +inline inode::inode (std::string const & __filename, struct stat const __stat) : filename(__filename), stat(__stat) { } inline bool compare (inode const & l, inode const & r) { |