diff options
author | Mattias Andrée <maandree@operamail.com> | 2012-11-07 20:49:52 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2012-11-07 20:49:52 +0100 |
commit | 09c3aa4790f11d2ce93a875a24eb5f0f2433c38d (patch) | |
tree | 216bc3d828f2fb95f29f71302a34810e4d8cc6d2 | |
parent | free allocated mojo (diff) | |
download | hungarian-algorithm-n3-09c3aa4790f11d2ce93a875a24eb5f0f2433c38d.tar.gz hungarian-algorithm-n3-09c3aa4790f11d2ce93a875a24eb5f0f2433c38d.tar.bz2 hungarian-algorithm-n3-09c3aa4790f11d2ce93a875a24eb5f0f2433c38d.tar.xz |
Revert "free allocated mojo"
This reverts commit cdc4eb058727e8491212b62ffbe5322952931c7a.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | hungarian.c | 40 |
2 files changed, 2 insertions, 40 deletions
@@ -1,5 +1,5 @@ all: - gcc -g -o "hungarian"{,.c} + gcc -o "hungarian"{,.c} test: ./"hungarian" diff --git a/hungarian.c b/hungarian.c index e701af9..90f9f64 100644 --- a/hungarian.c +++ b/hungarian.c @@ -185,15 +185,7 @@ int main(int argc, char** argv) cell sum = 0; for (i = 0; i < n; i++) - { sum += *(*(t + *(*(assignment + i) + 0)) + *(*(assignment + i) + 1)); - free(*(assignment + i)); - free(*(table + i)); - free(*(t + i)); - } - free(assignment); - free(table); - free(t); printf("\n\nSum: %li\n\n", sum); return 0; @@ -224,11 +216,7 @@ void print(cell** t, long n, long m, long** assignment) printf("%5li%s\e[m ", (cell)(*(*(t + i) + j)), (*(*(assigned + i) + j) ? "^" : " ")); } printf("\n\n"); - - free(*(assigned + i)); } - - free(assigned); } @@ -288,27 +276,13 @@ long** kuhn_match(cell** table, long n, long m) } for (i = n; i < m; i++) *(colCovered + i) = false; - free(prime); break; } kuhn_addAndSubtract(table, rowCovered, colCovered, n, m); } } - free(rowCovered); - free(colCovered); - free(altRow); - free(altCol); - free(rowPrimes); - free(colMarks); - - long** rc = kuhn_assign(marks, n, m); - - for (i = 0; i < n; i++) - free(*(marks + i)); - free(marks); - - return rc; + return kuhn_assign(marks, n, m); } @@ -381,8 +355,6 @@ byte** kuhn_mark(cell** t, long n, long m) *(colCovered + j) = true; } - free(rowCovered); - free(colCovered); return marks; } @@ -446,13 +418,7 @@ long* kuhn_findPrime(cell** t, byte** marks, boolean* rowCovered, boolean* colCo { p = BitSet_any(zeroes); if (p < 0) - { - free(zeroes.limbs); - free(zeroes.first); - free(zeroes.next); - free(zeroes.prev); return null; - } row = p / m; col = p % m; @@ -500,10 +466,6 @@ long* kuhn_findPrime(cell** t, byte** marks, boolean* rowCovered, boolean* colCo long* rc = new_longs(2); *rc = row; *(rc + 1) = col; - free(zeroes.limbs); - free(zeroes.first); - free(zeroes.next); - free(zeroes.prev); return rc; } } |