diff options
author | Martin Wilke <miwi@FreeBSD.org> | 2009-12-02 15:33:35 +0000 |
---|---|---|
committer | Martin Wilke <miwi@FreeBSD.org> | 2009-12-02 15:33:35 +0000 |
commit | 1f308318a4d4f7346b9e0e3f3104ae073d0ede8e (patch) | |
tree | 2ca450b706f41538acc4b3a0ecff1ab6988c1962 | |
parent | 4ceea426590b3184d607f0c7661ddc16bd48ebdd (diff) | |
download | ports-1f308318a4d4f7346b9e0e3f3104ae073d0ede8e.tar.gz ports-1f308318a4d4f7346b9e0e3f3104ae073d0ede8e.zip |
Notes
-rw-r--r-- | sysutils/samesame/Makefile | 2 | ||||
-rw-r--r-- | sysutils/samesame/distinfo | 6 | ||||
-rw-r--r-- | sysutils/samesame/files/patch-src-configure.h | 11 | ||||
-rw-r--r-- | sysutils/samesame/files/patch-src-main.cpp | 17 | ||||
-rw-r--r-- | sysutils/samesame/files/patch-src-matchmatrix.cpp | 94 | ||||
-rw-r--r-- | sysutils/samesame/files/patch-src-matchmatrix.h | 59 | ||||
-rw-r--r-- | sysutils/samesame/files/patch-src-sizegroup.cpp | 168 |
7 files changed, 4 insertions, 353 deletions
diff --git a/sysutils/samesame/Makefile b/sysutils/samesame/Makefile index 67f40f3b764b..c7014a52eb5a 100644 --- a/sysutils/samesame/Makefile +++ b/sysutils/samesame/Makefile @@ -5,7 +5,7 @@ # $FreeBSD$ PORTNAME= samesame -PORTVERSION= 1.6 +PORTVERSION= 1.7 CATEGORIES= sysutils MASTER_SITES= http://samesame.kruijff.org/ \ ${MASTER_SITE_LOCAL} diff --git a/sysutils/samesame/distinfo b/sysutils/samesame/distinfo index 26051055b820..f92a578fe100 100644 --- a/sysutils/samesame/distinfo +++ b/sysutils/samesame/distinfo @@ -1,3 +1,3 @@ -MD5 (samesame-1.6.tar.bz2) = 51dc947ff92934876f43a13851c5339f -SHA256 (samesame-1.6.tar.bz2) = ad9af477390a3f4017dcfbc3bee646401d4138b2c648bae7668ca039b165cea1 -SIZE (samesame-1.6.tar.bz2) = 110794 +MD5 (samesame-1.7.tar.bz2) = 596a64f4592313f9559c7309c6fb2aad +SHA256 (samesame-1.7.tar.bz2) = 5f98b1557d34d718b87b9f625a0ecf03f38fcf1d21e0c0283f31da017ebeb544 +SIZE (samesame-1.7.tar.bz2) = 111059 diff --git a/sysutils/samesame/files/patch-src-configure.h b/sysutils/samesame/files/patch-src-configure.h deleted file mode 100644 index b0b91b7c2896..000000000000 --- a/sysutils/samesame/files/patch-src-configure.h +++ /dev/null @@ -1,11 +0,0 @@ ---- src/configure.h Sun Nov 15 02:23:34 2009 -+++ src/configure.h Mon Nov 16 02:34:14 2009 -@@ -9,7 +9,7 @@ - /* If READ_ONLY_ONCES is defined the code will read each file only ones. - * If READ_ONLY_ONCES is not defined the code will use less memory. - */ --#ifdef LOW_MEMORY_PROFILE -+#ifndef LOW_MEMORY_PROFILE - #define READ_ONLY_ONCES - #endif // LOW_MEMORY_PROFILE - diff --git a/sysutils/samesame/files/patch-src-main.cpp b/sysutils/samesame/files/patch-src-main.cpp deleted file mode 100644 index 674fb30ae2c2..000000000000 --- a/sysutils/samesame/files/patch-src-main.cpp +++ /dev/null @@ -1,17 +0,0 @@ ---- src/main.cpp Sun Nov 15 00:06:17 2009 -+++ src/main.cpp Mon Nov 16 14:09:26 2009 -@@ -375,8 +375,12 @@ - size_t oldMinSize = minSize; - Holder holder; - -- // Reserve 1M memory for later (better memory management) -- char *dummy = new char[1048576]; -+ // Reserve memory for later (better memory management) -+#ifdef LOW_MEMORY_PROFILE -+ char *dummy = new char[1048576]; // 1 MB -+#else // LOW_MEMORY_PROFILE -+ char *dummy = new char[5 * 1048576]; // 5 MB -+#endif // LOW_MEMORY_PROFILE - - // Stage1 - reading the input - if (S_VERBOSE_LEVEL2(flags)) diff --git a/sysutils/samesame/files/patch-src-matchmatrix.cpp b/sysutils/samesame/files/patch-src-matchmatrix.cpp deleted file mode 100644 index 06ebd731081e..000000000000 --- a/sysutils/samesame/files/patch-src-matchmatrix.cpp +++ /dev/null @@ -1,94 +0,0 @@ ---- src/matchmatrix.cpp Sat Nov 14 04:27:23 2009 -+++ src/matchmatrix.cpp Mon Nov 16 02:34:10 2009 -@@ -98,6 +98,50 @@ - return arr[i][j - i]; - } - -+size_t MatchMatrix::getEqual(size_t i) const throw() -+{ -+ if (i > n) -+ { -+ fprintf(stderr, "%s:%u i (%u) must be smaller then %u\n", -+ __FILE__, __LINE__, i, n); -+ exit(EXIT_FAILURE); -+ } -+ return equal[i]; -+} -+ -+int MatchMatrix::getFd(size_t i) const throw() -+{ -+ if (i > n) -+ { -+ fprintf(stderr, "%s:%u i (%u) must be smaller then %u\n", -+ __FILE__, __LINE__, i, n); -+ exit(EXIT_FAILURE); -+ } -+ return fd[i]; -+} -+ -+void *MatchMatrix::getMm(size_t i) const throw() -+{ -+ if (i > n) -+ { -+ fprintf(stderr, "%s:%u i (%u) must be smaller then %u\n", -+ __FILE__, __LINE__, i, n); -+ exit(EXIT_FAILURE); -+ } -+ return mm[i]; -+} -+ -+void MatchMatrix::increaseEqual(size_t i) const throw() -+{ -+ if (i > n) -+ { -+ fprintf(stderr, "%s:%u i (%u) must be smaller then %u\n", -+ __FILE__, __LINE__, i, n); -+ exit(EXIT_FAILURE); -+ } -+ ++equal[i]; -+} -+ - void MatchMatrix::set(size_t i, size_t j, int result) throw() - { - if (i > n) -@@ -114,6 +158,40 @@ - } - arr[i][j - i] = result; - } -+ -+void MatchMatrix::setEqual(size_t i, size_t x) throw() -+{ -+ if (i > n) -+ { -+ fprintf(stderr, "%s:%u i (%u) must be smaller then %u\n", -+ __FILE__, __LINE__, i, n); -+ exit(EXIT_FAILURE); -+ } -+ equal[i] = x; -+} -+ -+int MatchMatrix::setFd(size_t i, int x) throw() -+{ -+ if (i > n) -+ { -+ fprintf(stderr, "%s:%u i (%u) must be smaller then %u\n", -+ __FILE__, __LINE__, i, n); -+ exit(EXIT_FAILURE); -+ } -+ return fd[i] = x; -+} -+ -+void MatchMatrix::setMm(size_t i, void *x) throw() -+{ -+ if (i > n) -+ { -+ fprintf(stderr, "%s:%u i (%u) must be smaller then %u\n", -+ __FILE__, __LINE__, i, n); -+ exit(EXIT_FAILURE); -+ } -+ mm[i] = x; -+} -+ - #endif // DEBUG - - void MatchMatrix::reset(size_t n) throw() diff --git a/sysutils/samesame/files/patch-src-matchmatrix.h b/sysutils/samesame/files/patch-src-matchmatrix.h deleted file mode 100644 index 513bdb1e84e2..000000000000 --- a/sysutils/samesame/files/patch-src-matchmatrix.h +++ /dev/null @@ -1,59 +0,0 @@ ---- src/matchmatrix.h Fri Nov 13 18:44:01 2009 -+++ src/matchmatrix.h Mon Nov 16 02:30:30 2009 -@@ -28,12 +28,11 @@ - { - size_t n; - signed char **arr; -- --public: - size_t *equal; - int *fd; - void **mm; -- -+ -+public: - /** - * Creates a MatchMatrix that is able to store the match results of - * n elements. -@@ -46,12 +45,41 @@ - int get(size_t i, size_t j) const throw() - { return arr[i][j - i]; } - -+ size_t getEqual(size_t i) const throw() -+ { return equal[i]; } -+ -+ int getFd(size_t i) const throw() -+ { return fd[i]; } -+ -+ void *getMm(size_t i) const throw() -+ { return mm[i]; } -+ -+ void increaseEqual(size_t i) const throw() -+ { ++equal[i]; } -+ - void set(size_t i, size_t j, int result) throw() - { arr[i][j - i] = result; } - -+ void setEqual(size_t i, size_t x) throw() -+ { equal[i] = x; } -+ -+ int setFd(size_t i, int x) throw() -+ { return fd[i] = x; } -+ -+ void setMm(size_t i, void *x) throw() -+ { mm[i] = x; } - #else // DEBUG - int get(size_t i, size_t j) const throw(); -+ size_t getEqual(size_t i) const throw(); -+ int getFd(size_t i) const throw(); -+ void *getMm(size_t i) const throw(); -+ -+ void increaseEqual(size_t i) const throw(); -+ - void set(size_t i, size_t j, int result) throw(); -+ void setEqual(size_t i, size_t x) throw(); -+ int setFd(size_t i, int x) throw(); -+ void setMm(size_t i, void *x) throw(); - #endif // DEBUG - - /** diff --git a/sysutils/samesame/files/patch-src-sizegroup.cpp b/sysutils/samesame/files/patch-src-sizegroup.cpp deleted file mode 100644 index be64dd869f17..000000000000 --- a/sysutils/samesame/files/patch-src-sizegroup.cpp +++ /dev/null @@ -1,168 +0,0 @@ ---- src/sizegroup.cpp Sat Nov 14 23:34:59 2009 -+++ src/sizegroup.cpp Mon Nov 16 02:29:51 2009 -@@ -36,7 +36,7 @@ - static struct SameGroupBuffer - { - size_t n, size, pagesize; -- char *buffer; -+ char *buf; - - SameGroupBuffer(); - ~SameGroupBuffer(); -@@ -53,12 +53,12 @@ - #else // LOW_MEMORY_PROFILE - size = 1 << 24; - #endif // LOW_MEMORY_PROFILE -- buffer = new char[size]; -+ buf = new char[size]; - } - - SameGroupBuffer::~SameGroupBuffer() - { -- delete buffer; -+ delete buf; - } - - void SameGroupBuffer::setN(size_t n) -@@ -77,7 +77,7 @@ - exit(EXIT_FAILURE); - } - #endif // DEBUG -- return buffer + index * pagesize; -+ return buf + index * pagesize; - } - #endif // READ_ONLY_ONCES - -@@ -136,7 +136,7 @@ - __FILE__, __LINE__); - exit(EXIT_FAILURE); - } --#endif -+#endif // DEBUG - for (size_t i = 0; i < n; ++i) - hash[i]->sort(compareFilename); - #ifdef DEBUG -@@ -147,7 +147,7 @@ - __FILE__, __LINE__); - exit(EXIT_FAILURE); - } --#endif -+#endif // DEBUG - hash.sort(compare); - } - -@@ -188,8 +188,6 @@ - int (&f)(const SizeGroup &, const FileGroup &, const Filename &, - const FileGroup &, const Filename &, int), - size_t fileSize, size_t &nIdenticals, --#ifndef READ_ONLY_ONCES --#endif // READ_ONLY_ONCES - int flags, size_t &i, size_t &j, size_t &n, - FileGroup &left, FileGroup &right) - { -@@ -213,7 +211,7 @@ - - #ifndef READ_ONLY_ONCES - // Do a physically check if we couldn't use logic -- if (!(result)) -+ if (!result) - { - result = left.fcmp(right, fileSize); - if (result > 0 && result & FILE_IDENTICAL) -@@ -306,10 +304,6 @@ - * If READ_ONLY_ONCES is not defined the code will use less memory. - */ - #ifdef READ_ONLY_ONCES -- size_t *equal = match.equal; -- int *fd = match.fd; -- void **mm = match.mm; -- - // Open files - buffer.setN(n); - for (size_t i = 0; i < n; ++i) -@@ -333,12 +327,15 @@ - if (preCheck != NULL && preCheck(*this, *hash[i], *hash[j])) - { - match.set(i, j, FILE_DIFFERENT); -- ++equal[i], ++equal[j]; -+ match.increaseEqual(i); -+ match.increaseEqual(j); - } - - // Open files -- if (equal[i] < n -1 && (fd[i] = hash[i]->open(O_RDONLY)) < 0) -+ if (match.getEqual(i) < n -1 && -+ match.setFd(i, hash[i]->open(O_RDONLY)) < 0) - match.set(i, n-1, FILE_OPEN1_ERROR); -+ - } - - // Compare the files -@@ -350,50 +347,51 @@ - - // read pages - for (size_t i = 0; i < n; ++i) -- if (match.get(i, n-1) >= 0 && equal[i] < n - 1) -+ if (match.get(i, n-1) >= 0 && match.getEqual(i) < n - 1) - if (USE_MMAP(fileSize)) - { -- mm[i] = mmap(0, size, PROT_READ, MAP_SHARED, fd[i], offset); -- mm[i] = mmap(0, size, PROT_READ, MAP_SHARED, fd[i], offset); -- if (mm[i] == MAP_FAILED) -+ void *mm = mmap(0, size, PROT_READ, MAP_SHARED, match.getFd(i), offset); -+ match.setMm(i, mm); -+ if (mm == MAP_FAILED) - match.set(i, n-1, FILE_READ1_ERROR); -- posix_madvise(mm[i], size, POSIX_MADV_WILLNEED); -+ posix_madvise(mm, size, POSIX_MADV_WILLNEED); - } -- else if (read(fd[i], buffer[i], size) < 0) -+ else if (read(match.getFd(i), buffer[i], size) < 0) - match.set(i, n-1, FILE_READ1_ERROR); - - // compare pages - for (size_t i = 0; i < n; ++i) - { -- if (equal[i] == n - 1 || match.get(i, n-1) < 0) -+ if (match.getEqual(i) == n - 1 || match.get(i, n-1) < 0) - continue; - for (size_t j = i + 1; j < n; ++j) - if (match.get(i, j) == FILE_DIFFERENT) - continue; - else if (memcmp( -- USE_MMAP(fileSize) ? mm[i] : buffer[i], -- USE_MMAP(fileSize) ? mm[j] : buffer[j], -+ USE_MMAP(fileSize) ? match.getMm(i) : buffer[i], -+ USE_MMAP(fileSize) ? match.getMm(j) : buffer[j], - size) != 0) - { - match.set(i, j, FILE_DIFFERENT); -- ++equal[i], ++equal[j]; -+ match.increaseEqual(i); -+ match.increaseEqual(j); - } - } - - // unread? - for (size_t i = 0; i < n; ++i) -- if (mm[i] != NULL) -+ if (match.getMm(i) != NULL) - { -- posix_madvise(mm[i], size, POSIX_MADV_NORMAL); -- munmap(mm[i], size); -- mm[i] = NULL; -+ posix_madvise(match.getMm(i), size, POSIX_MADV_NORMAL); -+ munmap(match.getMm(i), size); -+ match.setMm(i, NULL); - } - } - - // close files - for (size_t i = 0; i < n; ++i) -- if (fd[i] != 0) -- close(fd[i]); -+ if (!match.getFd(i) != 0) -+ close(match.getFd(i)); - - // mark identicals - for (size_t i = 0; i < n; ++i) |