Skip to content

Commit

Permalink
file: fix attribute naming
Browse files Browse the repository at this point in the history
  • Loading branch information
sahib committed Nov 15, 2016
1 parent d7e32c5 commit 8b4c646
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
1 change: 1 addition & 0 deletions .clang_complete
Expand Up @@ -13,6 +13,7 @@
-fPIC
-g
-D_GNU_SOURCE
-DHAVE_STAT64=0
-I/usr/include/gtk-3.0
-I/usr/include/at-spi2-atk/2.0
-I/usr/include/gtk-3.0
Expand Down
2 changes: 1 addition & 1 deletion lib/file.c
Expand Up @@ -84,7 +84,7 @@ RmFile *rm_file_new(struct RmSession *session, const char *path,
self->is_original = false;
self->is_symlink = false;
self->path_index = path_index;
self->outter_link_count = -1;
self->outer_link_count = -1;

return self;
}
Expand Down
5 changes: 3 additions & 2 deletions lib/file.h
Expand Up @@ -117,13 +117,14 @@ typedef struct RmFile {
gint16 depth;

/* Link count (number of hardlinks + 1) of the file as told by stat()
* This is used for the 'hH'-sortcriteria.
*/
gint16 link_count;

/* Hardlinks to this file *outside* of the paths that rmlint traversed.
* This is used for the outlyer sortcriteria (O).
* This is used for the 'oO'-sortcriteria.
* */
gint16 outter_link_count;
gint16 outer_link_count;

/* Depth of the path of this file.
*/
Expand Down
12 changes: 6 additions & 6 deletions lib/preprocess.c
Expand Up @@ -376,10 +376,10 @@ int rm_pp_cmp_orig_criteria(const RmFile *a, const RmFile *b, const RmSession *s
RmCfg *sets = session->cfg;

for(int i = 0, regex_cursor = 0; sets->sort_criteria[i]; i++) {
long cmp = 0;
gint64 cmp = 0;
switch(tolower((unsigned char)sets->sort_criteria[i])) {
case 'm':
cmp = (long)(a->mtime) - (long)(b->mtime);
cmp = (gint64)(a->mtime) - (gint64)(b->mtime);
break;
case 'a':
cmp = g_ascii_strcasecmp(a->folder->basename, b->folder->basename);
Expand All @@ -388,16 +388,16 @@ int rm_pp_cmp_orig_criteria(const RmFile *a, const RmFile *b, const RmSession *s
cmp = strlen(a->folder->basename) - strlen(b->folder->basename);
break;
case 'd':
cmp = (short)a->depth - (short)b->depth;
cmp = (gint64)a->depth - (gint64)b->depth;
break;
case 'h':
cmp = (long)a->link_count - (long)b->link_count;
cmp = (gint64)a->link_count - (gint64)b->link_count;
break;
case 'o':
cmp = (guint64)a->outter_link_count - (guint64)b->outter_link_count;
cmp = (gint64)a->outer_link_count - (gint64)b->outer_link_count;
break;
case 'p':
cmp = (long)a->path_index - (long)b->path_index;
cmp = (gint64)a->path_index - (gint64)b->path_index;
break;
case 'x': {
cmp = rm_pp_cmp_by_regex(
Expand Down
8 changes: 4 additions & 4 deletions lib/shredder.c
Expand Up @@ -1210,18 +1210,18 @@ void rm_shred_group_find_original(RmSession *session, GQueue *files, RmShredGrou
* unbundle the cluster and append it to the queue
*/
GQueue *hardlinks = file->hardlinks.files;
file->outter_link_count = file->link_count - (hardlinks->length + 1);
file->outer_link_count = file->link_count - (hardlinks->length + 1);

for(GList *link = hardlinks->head; link; link = link->next) {
RmFile *bundled_file = link->data;
bundled_file->outter_link_count = file->outter_link_count;
bundled_file->outer_link_count = file->outer_link_count;
g_queue_push_tail(files, bundled_file);
}

g_queue_free(hardlinks);
file->hardlinks.files = NULL;
} else if(file->outter_link_count < 0) {
file->outter_link_count = file->link_count - 1;
} else if(file->outer_link_count < 0) {
file->outer_link_count = file->link_count - 1;
}

if (status == RM_SHRED_GROUP_FINISHING) {
Expand Down

0 comments on commit 8b4c646

Please sign in to comment.