Commit graph

26 commits

Author SHA1 Message Date
Yorhel
ab435e664f Converted all code to call the compll functions 2010-05-10 11:08:44 +02:00
Yorhel
6fa56c1b38 Store the name of the item in the dir struct itself
Rather than storing a pointer to another memory allocation in the
struct. This saves some memory and improves performance by significantly
decreasing the number of calls to [c|m]alloc() and free().
2010-04-28 15:32:47 +02:00
Yorhel
eed949d48d Changed directory listings to a doubly linked list
This significantly improves the performance when browsing large
directories. It is somewhat costly on the memory usage, though. :-(
2010-04-27 17:18:56 +02:00
Yorhel
fe21608e98 Correctly update directory sizes upon removing a hard link 2010-03-03 14:40:56 +01:00
Yorhel
1cc0e5a50f Only count the size of each hard link once for each directory
The displayed directory sizes are now fully correct, although in its
current state it's not all that intuitive because:

  directory size != sum(size of all files and subdirectories)

This should probably be fixed later on by splitting the sizes into a
shared and non-shared part.

Also, the sizes displayed after a recalculation or deletion are
incorrect, I'll fix this later on.
2010-02-28 16:56:45 +01:00
Yorhel
88cd199d94 Link hard linked files together with a circular linked list
The directory sizes are now incorrect as hard links will be counted
twice again (as if there wasn't any detection in the first place), but
this will get fixed by adding a shared size field.

This method of keeping track of hard links is a lot faster and allows
adding an interface which lists the found links.
2010-02-27 15:21:25 +01:00
Yorhel
101731ed13 Copyright year bump 2010-02-27 15:20:57 +01:00
Yorhel
b7d59bee5b Properly display MiB units instead of MB
Fixes bug #2831412 (debian #539553)
2009-08-03 14:26:10 +02:00
Yorhel
6de0a8ec00 Use correct hard link information after partial recalculation or deletion
Hard link detection is now done in a separate pass on the in-memory tree,
and duplicates can be 'removed' and 're-added' on the fly. When making any
changes in the tree, all hard links are re-added before the operation and
removed again afterwards.

While this guarantees that all hard link information is correct, it does
have a few drawbacks. I can currently think of two:

 1. It's not the most efficient way to do it, and may be quite slow on
    large trees. Will have to do some benchmarks later to see whether
    it is anything to be concerned about.

 2. The first encountered item is considered as 'counted' and all items
    encountered after that are considered as 'duplicate'. Because the
    order in which we traverse the tree doesn't always have to be the
    same, the items that will be considered as 'duplicate' can vary with
    each deletion or re-calculation. This might cause confusion for
    people who aren't aware of how hard links work.
2009-05-11 20:02:46 +02:00
Yorhel
ece21a668d Fixed display of the root directory 2009-04-26 13:10:00 +02:00
Yorhel
4bb7d6b7c2 Removed reliance on PATH_MAX on most places
ncdu already does seem to handle longer paths now, though there are
still a few places where the code still relies on PATH_MAX. Will fix
those later.
2009-04-23 21:15:11 +02:00
Yorhel
bb8c2e66e7 freedir() shouldn't need to return anything 2009-04-19 12:47:22 +02:00
Yorhel
b24c3dee40 Got rid of SF_SI
It was a totally useless feature, anyway.
2009-04-18 14:05:45 +02:00
Yorhel
fb7b9f94df util.c:freedir() doesn't have to do anything with the selected flag 2009-04-11 14:16:51 +02:00
Yorhel
fa90c77c96 Rewrote util.h to the new style 2009-04-11 11:38:36 +02:00
yorhel
e7fb90fc67 Year bump
git-svn-id: svn://blicky.net/ncdu/trunk@48 ce56bc8d-f834-0410-b703-f827bd498a76
2009-01-11 09:34:19 +00:00
yorhel
c306d3fe3b Updated copyright year to cover 2008 as well
git-svn-id: svn://blicky.net/ncdu/trunk@36 ce56bc8d-f834-0410-b703-f827bd498a76
2008-08-02 13:59:58 +00:00
yorhel
db920f8dab * Added error handling for the import feature
* Created own window-functions and removed ncurses window usage
* Rewrote fullsize


git-svn-id: svn://blicky.net/ncdu/trunk@27 ce56bc8d-f834-0410-b703-f827bd498a76
2007-08-16 08:36:58 +00:00
yorhel
96d0ffffa2 The "reference to parent directory" hack is now only used in drawBrowser in browser.c, and is not included in the main dir structure anymore. (less code, easier, faster, less memory usage)
git-svn-id: svn://blicky.net/ncdu/trunk@26 ce56bc8d-f834-0410-b703-f827bd498a76
2007-08-12 09:52:24 +00:00
yorhel
4654bb93c4 Two small bug fixes: interface bug in the delete progress, and getpath returned double slash on root
git-svn-id: svn://blicky.net/ncdu/trunk@22 ce56bc8d-f834-0410-b703-f827bd498a76
2007-08-05 11:12:40 +00:00
yorhel
2a9b34ce2d * Added 'a'-key to toggle between showing apparent size and disk usage
* Added 'i'-key to show a small window containing info on the selected item
* Cleaned up file flags and browse flags


git-svn-id: svn://blicky.net/ncdu/trunk@19 ce56bc8d-f834-0410-b703-f827bd498a76
2007-08-01 15:01:42 +00:00
yorhel
fa0aa6b53b * Calculate both apparent size and disk usage
* Removed apparent sizes option
* Combined "files" and "dirs" to "items" in the dir structure
* Updated TODO


git-svn-id: svn://blicky.net/ncdu/trunk@18 ce56bc8d-f834-0410-b703-f827bd498a76
2007-08-01 13:17:26 +00:00
yorhel
c96bf1636a Changed struct dir from a doubly to a singly linked list (less memory usage, faster, and easier)
git-svn-id: svn://blicky.net/ncdu/trunk@13 ce56bc8d-f834-0410-b703-f827bd498a76
2007-07-26 16:37:33 +00:00
yorhel
362554d2ac Added 'r' key to refresh the current directory
git-svn-id: svn://blicky.net/ncdu/trunk@11 ce56bc8d-f834-0410-b703-f827bd498a76
2007-07-26 12:56:24 +00:00
yorhel
ce6785124c Rewrote calc.c to be more flexible and clarifying, and changed the global 'dir' to a pointer
git-svn-id: svn://blicky.net/ncdu/trunk@10 ce56bc8d-f834-0410-b703-f827bd498a76
2007-07-25 18:38:49 +00:00
yorhel
6e3bbe69ee Initial import (ncdu-1.1)
git-svn-id: svn://blicky.net/ncdu/trunk@1 ce56bc8d-f834-0410-b703-f827bd498a76
2007-07-20 11:15:46 +00:00