summaryrefslogtreecommitdiff
path: root/src/slices.c
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2011-10-08 17:05:19 +0000
committerLudovic Pouzenc <ludovic@pouzenc.fr>2011-10-08 17:05:19 +0000
commit809fe0d67eb39f9ec08bca65735241803bc923f3 (patch)
tree2eccce3ae1fe8c431f845242bb64297309b2fb9e /src/slices.c
parent60d64987c7e97bae385efef62f73cdcd7d3b5257 (diff)
download2011-ddhardrescue-809fe0d67eb39f9ec08bca65735241803bc923f3.tar.gz
2011-ddhardrescue-809fe0d67eb39f9ec08bca65735241803bc923f3.tar.bz2
2011-ddhardrescue-809fe0d67eb39f9ec08bca65735241803bc923f3.zip
Correction du bug de zoom (c'était juste le calcul de "pos" qui était foireux).
Création des méthodes sliceDelete et slicesDelete et utilisation à la fin du main. git-svn-id: file:///var/svn/2011-ddhardrescue/trunk@25 d3078510-dda0-49f1-841c-895ef4b7ec81
Diffstat (limited to 'src/slices.c')
-rw-r--r--src/slices.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/slices.c b/src/slices.c
index 36f7bb1..06fa1b7 100644
--- a/src/slices.c
+++ b/src/slices.c
@@ -20,6 +20,10 @@ slice_t *sliceNew(address_t begin, address_t end, sliceStatus_t status, slice_t
return s;
}
+void sliceDelete(slice_t *s) {
+ free(s);
+}
+
// Return the numbers of slices after split (3 in the general case, 2 or 1 in particular cases. -1 is memory error)
int sliceSplit(slices_t *slices, slice_t *initialSlice, address_t splitAt, sliceStatus_t statusBefore, sliceStatus_t statusAt, sliceStatus_t statusAfter) {
slice_t *secondSlice, *thirdSlice, *rightSlice;
@@ -122,6 +126,18 @@ slices_t *slicesNewSingleton(address_t begin, address_t end, sliceStatus_t statu
return ss;
}
+void slicesDelete(slices_t *ss) {
+ slice_t *curr, *toFree;
+
+ curr=ss->first;
+ while (curr!=NULL) {
+ toFree=curr;
+ curr=curr->next;
+ sliceDelete(toFree);
+ }
+ free(ss);
+}
+
void slicesAppend(slices_t *slices, slice_t *slice) {
pthread_mutex_lock(&(slices->writeOrConsistentReadMutex));