summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2012-08-27 18:32:29 +0200
committerYorhel <git@yorhel.nl>2012-08-27 18:34:45 +0200
commita61c784b8c0d5595a85fb3b0233b2cc75e14716c (patch)
tree21dbc2bb455bb8b11e962eecaf67d26610853f41 /src
parent73690f8f835a1b1044492cab84efa3b28760063b (diff)
Use int instead of long for struct dir->items
2 billion files should be enough for everyone. You probably won't have enough memory to scan such a filesystem. int is a better choice than long, as sizeof(int) is 4 on pretty much any system where ncdu runs.
Diffstat (limited to 'src')
-rw-r--r--src/dir.h2
-rw-r--r--src/dir_common.c2
-rw-r--r--src/global.h2
-rw-r--r--src/util.c2
-rw-r--r--src/util.h2
5 files changed, 5 insertions, 5 deletions
diff --git a/src/dir.h b/src/dir.h
index 94899ab..e9d42f9 100644
--- a/src/dir.h
+++ b/src/dir.h
@@ -80,7 +80,7 @@ struct dir_output {
/* The output code is responsible for updating these stats. Can be 0 when not
* available. */
int64_t size;
- long items;
+ int items;
};
diff --git a/src/dir_common.c b/src/dir_common.c
index b0080cd..f13e667 100644
--- a/src/dir_common.c
+++ b/src/dir_common.c
@@ -182,7 +182,7 @@ void dir_draw() {
if(dir_fatalerr)
fprintf(stderr, "\r%s.\n", dir_fatalerr);
else
- fprintf(stderr, "\r%-55s %8ld files /%s",
+ fprintf(stderr, "\r%-55s %8d files /%s",
cropstr(dir_curpath, 55), dir_output.items, formatsize(dir_output.size));
break;
case 2:
diff --git a/src/global.h b/src/global.h
index e244d27..e1f273e 100644
--- a/src/global.h
+++ b/src/global.h
@@ -62,7 +62,7 @@ struct dir {
struct dir *parent, *next, *prev, *sub, *hlnk;
int64_t size, asize;
ino_t ino;
- long items;
+ int items;
dev_t dev;
unsigned char flags;
char name[3]; /* must be large enough to hold ".." */
diff --git a/src/util.c b/src/util.c
index f78bddd..0cd7fb1 100644
--- a/src/util.c
+++ b/src/util.c
@@ -283,7 +283,7 @@ struct dir *getroot(struct dir *d) {
}
-void addparentstats(struct dir *d, int64_t size, int64_t asize, long items) {
+void addparentstats(struct dir *d, int64_t size, int64_t asize, int items) {
while(d) {
d->size += size;
d->asize += asize;
diff --git a/src/util.h b/src/util.h
index a8dd116..ac6b467 100644
--- a/src/util.h
+++ b/src/util.h
@@ -82,7 +82,7 @@ char *getpath(struct dir *);
struct dir *getroot(struct dir *);
/* Adds a value to the size, asize and items fields of *d and its parents */
-void addparentstats(struct dir *, int64_t, int64_t, long);
+void addparentstats(struct dir *, int64_t, int64_t, int);
#endif