From 9d0562d22cef95b0db1af30e199a371670ca8050 Mon Sep 17 00:00:00 2001 From: Timo Weingärtner Date: Tue, 23 Apr 2013 18:28:33 +0200 Subject: remove hashing stuff the cases in which that gave a speedup are rare to nonexistent --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a55a9dd..faad8fa 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with hadori. If not, see . -LDFLAGS+=-lz -lboost_program_options +LDFLAGS+=-lboost_program_options CXXFLAGS?=-O2 -Wall CXXFLAGS+=-std=c++0x CPPFLAGS+=-D_FILE_OFFSET_BITS=64 -- cgit v1.2.3 From 5d0c23bc87b5be492869616acc42e619914aae38 Mon Sep 17 00:00:00 2001 From: Timo Weingärtner Date: Wed, 24 Apr 2013 16:31:15 +0200 Subject: inode.h is not so big anymore, merge it into hadori.C --- Makefile | 2 +- hadori.C | 29 ++++++++++++++++++++++++++++- inode.h | 53 ----------------------------------------------------- 3 files changed, 29 insertions(+), 55 deletions(-) delete mode 100644 inode.h (limited to 'Makefile') diff --git a/Makefile b/Makefile index faad8fa..9776253 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ hadori.1: hadori help2man -n $< -o $@ -N ./$< hadori: hadori.o -hadori.o: hadori.C inode.h version.h +hadori.o: hadori.C version.h version.h: test ! -d .git || git describe | sed 's/^\(.*\)$$/#define HADORI_VERSION "hadori \1"/' > $@ diff --git a/hadori.C b/hadori.C index 4867648..d0b19ab 100644 --- a/hadori.C +++ b/hadori.C @@ -26,6 +26,7 @@ namespace po = boost::program_options; #include #include #include +#include #include #include @@ -35,7 +36,6 @@ namespace po = boost::program_options; #include #include -#include "inode.h" #include "version.h" // needed for equal_range and range-for @@ -51,6 +51,33 @@ template T& end(pair & ip) { po::variables_map config; std::ostream debug(std::clog.rdbuf()), verbose(std::clog.rdbuf()), error(std::clog.rdbuf()); +struct inode { + std::string const filename; + struct stat const stat; +}; + +inline bool compare (inode const & l, inode const & r) { + char lbuffer[1 << 14]; + char rbuffer[1 << 14]; + std::ifstream lf(l.filename.c_str()); + std::ifstream rf(r.filename.c_str()); + + while (not lf.eof()) { + lf.read(lbuffer, sizeof(lbuffer)); + rf.read(rbuffer, sizeof(rbuffer)); + if (lf.gcount() != rf.gcount()) + return false; + if (memcmp(lbuffer, rbuffer, lf.gcount())) + return false; + } + return true; +} + +inline std::ostream& operator<< (std::ostream& os, inode const & i) { + os << "Inode " << i.stat.st_ino << ", represented by " << i.filename; + return os; +} + void do_link (inode const & i, std::string const & other) { if (!link(i.filename.c_str(), other.c_str())) { error << "linking " << i << " to " << other << " succeeded before unlinking (race condition)" << std::endl; diff --git a/inode.h b/inode.h deleted file mode 100644 index c9768d2..0000000 --- a/inode.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2011 Timo Weingärtner - * - * This file is part of hadori. - * - * hadori is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Foobar is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with hadori. If not, see . - */ - -#include -#include -#include - -#include -#include -#include - -struct inode { - std::string const filename; - struct stat const stat; -}; - -inline bool compare (inode const & l, inode const & r) { - char lbuffer[1 << 14]; - char rbuffer[1 << 14]; - std::ifstream lf(l.filename.c_str()); - std::ifstream rf(r.filename.c_str()); - - while (not lf.eof()) { - lf.read(lbuffer, sizeof(lbuffer)); - rf.read(rbuffer, sizeof(rbuffer)); - if (lf.gcount() != rf.gcount()) - return false; - if (memcmp(lbuffer, rbuffer, lf.gcount())) - return false; - } - return true; -} - -inline std::ostream& operator<< (std::ostream& os, inode const & i) { - os << "Inode " << i.stat.st_ino << ", represented by " << i.filename; - return os; -} -- cgit v1.2.3 From d34f4e8e84f3c503a830d1495945f8c4da7c4abe Mon Sep 17 00:00:00 2001 From: Timo Weingärtner Date: Mon, 17 Jun 2013 17:43:33 +0200 Subject: fix copy&paste oversight in license --- Makefile | 2 +- hadori.C | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 9776253..dbf5ab6 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # -# Foobar is distributed in the hope that it will be useful, +# hadori is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. diff --git a/hadori.C b/hadori.C index d0b19ab..a96f1d6 100644 --- a/hadori.C +++ b/hadori.C @@ -8,7 +8,7 @@ * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * Foobar is distributed in the hope that it will be useful, + * hadori is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -- cgit v1.2.3 From 9933463097df9fe16e446a0744204dbe04223544 Mon Sep 17 00:00:00 2001 From: Timo Weingärtner Date: Sun, 17 Nov 2013 14:05:54 +0100 Subject: use LDLIBS instead of LDFLAGS LDLIBS are put behind the prerequisites by make's built-in rules so linking won't fail with --as-needed. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index dbf5ab6..b3cbd47 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with hadori. If not, see . -LDFLAGS+=-lboost_program_options +LDLIBS=-lboost_program_options CXXFLAGS?=-O2 -Wall CXXFLAGS+=-std=c++0x CPPFLAGS+=-D_FILE_OFFSET_BITS=64 -- cgit v1.2.3 From 38c62a8019f1a19ec93ea16d34fa2f05c702a564 Mon Sep 17 00:00:00 2001 From: Timo Weingärtner Date: Sun, 17 Nov 2013 14:33:18 +0100 Subject: Makefile: add libstdc++ to LDLIBS --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index b3cbd47..b480e1c 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License # along with hadori. If not, see . -LDLIBS=-lboost_program_options +LDLIBS=-lboost_program_options -lstdc++ CXXFLAGS?=-O2 -Wall CXXFLAGS+=-std=c++0x CPPFLAGS+=-D_FILE_OFFSET_BITS=64 -- cgit v1.2.3 From 2d2195cf1caaac1c5a3b081fc1a49d1f7c12bc96 Mon Sep 17 00:00:00 2001 From: Timo Weingärtner Date: Sun, 17 Nov 2013 14:36:18 +0100 Subject: Makefile: C++11 has been ready for a while now --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index b480e1c..e36a97f 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ LDLIBS=-lboost_program_options -lstdc++ CXXFLAGS?=-O2 -Wall -CXXFLAGS+=-std=c++0x +CXXFLAGS+=-std=c++11 CPPFLAGS+=-D_FILE_OFFSET_BITS=64 all: hadori.1 -- cgit v1.2.3 From 3c42fb81eb2cc9e658afc2156afa5d62880f3c7e Mon Sep 17 00:00:00 2001 From: Timo Weingärtner Date: Sun, 17 Nov 2013 14:38:02 +0100 Subject: Makefile: reset version.h on clean when in git --- Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e36a97f..e8f40f6 100644 --- a/Makefile +++ b/Makefile @@ -33,5 +33,6 @@ version.h: clean: rm -f hadori hadori.o hadori.1 + test ! -d .git || git checkout -f -- version.h .PHONY: version.h clean -- cgit v1.2.3