Skip to content
Snippets Groups Projects
Commit 3ad39f37 authored by Yorhel's avatar Yorhel
Browse files

Don't touch the original tree while recalculating

This change makes it possible to still show the browser with correct
(previous) data while calculating.
parent 4a751f05
No related branches found
No related tags found
No related merge requests found
...@@ -414,24 +414,11 @@ void calc_process() { ...@@ -414,24 +414,11 @@ void calc_process() {
t->size = fs.st_blocks * S_BLKSIZE; t->size = fs.st_blocks * S_BLKSIZE;
t->asize = fs.st_size; t->asize = fs.st_size;
t->flags |= FF_DIR; t->flags |= FF_DIR;
if(orig) {
t->parent = orig->parent;
t->next = orig->next;
}
t->name = (char *) malloc(strlen(tmp)+1); t->name = (char *) malloc(strlen(tmp)+1);
strcpy(t->name, orig ? orig->name : tmp); strcpy(t->name, orig ? orig->name : tmp);
root = t; root = t;
curdev = fs.st_dev; curdev = fs.st_dev;
/* update parents, if any */
if(orig) {
for(t=t->parent; t!=NULL; t=t->parent) {
t->size += root->size;
t->asize += root->asize;
t->items++;
}
}
/* start calculating */ /* start calculating */
if(!calc_dir(root, tmp) && !failed) { if(!calc_dir(root, tmp) && !failed) {
pstate = ST_BROWSE; pstate = ST_BROWSE;
...@@ -439,6 +426,14 @@ void calc_process() { ...@@ -439,6 +426,14 @@ void calc_process() {
/* update references and free original item */ /* update references and free original item */
if(orig) { if(orig) {
root->parent = orig->parent;
root->next = orig->next;
for(t=root->parent; t!=NULL; t=t->parent) {
t->size += root->size;
t->asize += root->asize;
t->items += root->items+1;
}
if(orig->parent) { if(orig->parent) {
t = orig->parent->sub; t = orig->parent->sub;
if(t == orig) if(t == orig)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment