From ed02819deb98c8eafe94c9eedc3e9f00e07ea9cc Mon Sep 17 00:00:00 2001 From: Przemyslaw Pawelczyk Date: Fri, 3 May 2013 22:10:48 +0200 Subject: Introduce settings structure. No more passing particular options (like git or mtime) to functions. The structure is meant to be immutable after filling during startup. --- metaentry.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'metaentry.c') diff --git a/metaentry.c b/metaentry.c index 79db236..d2a29e3 100644 --- a/metaentry.c +++ b/metaentry.c @@ -407,13 +407,13 @@ mentries_recurse_wo_git(const char *path, struct metahash *mhash) /* Recurses opath and adds metadata entries to the metaentry list */ void -mentries_recurse_path(const char *opath, struct metahash **mhash, bool git) +mentries_recurse_path(const char *opath, struct metahash **mhash, msettings *st) { char *path = normalize_path(opath); if (!(*mhash)) *mhash = mhash_alloc(); - if (git) + if (st->do_git) mentries_recurse(path, *mhash); else mentries_recurse_wo_git(path, *mhash); @@ -601,7 +601,7 @@ mentry_compare_xattr(struct metaentry *left, struct metaentry *right) /* Compares two metaentries and returns an int with a bitmask of differences */ int -mentry_compare(struct metaentry *left, struct metaentry *right, bool do_mtime) +mentry_compare(struct metaentry *left, struct metaentry *right, msettings *st) { int retval = DIFF_NONE; @@ -625,7 +625,7 @@ mentry_compare(struct metaentry *left, struct metaentry *right, bool do_mtime) if ((left->mode & S_IFMT) != (right->mode & S_IFMT)) retval |= DIFF_TYPE; - if (do_mtime && strcmp(left->path, metafile) && + if (st->do_mtime && strcmp(left->path, st->metafile) && (left->mtime != right->mtime || left->mtimensec != right->mtimensec)) retval |= DIFF_MTIME; @@ -644,7 +644,7 @@ mentries_compare(struct metahash *mhashreal, struct metahash *mhashstored, void (*pfunc) (struct metaentry *real, struct metaentry *stored, int cmp), - bool do_mtime) + msettings *st) { struct metaentry *real, *stored; int key; @@ -661,7 +661,7 @@ mentries_compare(struct metahash *mhashreal, if (!stored) pfunc(real, NULL, DIFF_ADDED); else - pfunc(real, stored, mentry_compare(real, stored, do_mtime)); + pfunc(real, stored, mentry_compare(real, stored, st)); } for (stored = mhashstored->bucket[key]; stored; stored = stored->next) { -- cgit v1.2.1