Make the macros take a pointer to a 'struct stat'. This is so that it should be easier to understand what is going on, and that the macros can later be implemented as a inline function if we want to. Impact: cosmetic change Signed-off-by: Kjetil Barvik <barvik@xxxxxxxxxxxx> --- builtin-fetch-pack.c | 4 ++-- git-compat-util.h | 8 ++++---- read-cache.c | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/builtin-fetch-pack.c b/builtin-fetch-pack.c index d571253..0cd50f3 100644 --- a/builtin-fetch-pack.c +++ b/builtin-fetch-pack.c @@ -800,13 +800,13 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args, int fd; mtime.sec = st.st_mtime; - mtime.nsec = ST_MTIME_NSEC(st); + mtime.nsec = ST_MTIME_NSEC(&st); if (stat(shallow, &st)) { if (mtime.sec) die("shallow file was removed during fetch"); } else if (st.st_mtime != mtime.sec #ifdef USE_NSEC - || ST_MTIME_NSEC(st) != mtime.nsec + || ST_MTIME_NSEC(&st) != mtime.nsec #endif ) die("shallow file was changed during fetch"); diff --git a/git-compat-util.h b/git-compat-util.h index 1906253..4a633be 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -394,11 +394,11 @@ void git_qsort(void *base, size_t nmemb, size_t size, #define ST_MTIME_NSEC(st) 0 #else #ifdef USE_ST_TIMESPEC -#define ST_CTIME_NSEC(st) ((unsigned int)((st).st_ctimespec.tv_nsec)) -#define ST_MTIME_NSEC(st) ((unsigned int)((st).st_mtimespec.tv_nsec)) +#define ST_CTIME_NSEC(st) ((unsigned int)((st)->st_ctimespec.tv_nsec)) +#define ST_MTIME_NSEC(st) ((unsigned int)((st)->st_mtimespec.tv_nsec)) #else -#define ST_CTIME_NSEC(st) ((unsigned int)((st).st_ctim.tv_nsec)) -#define ST_MTIME_NSEC(st) ((unsigned int)((st).st_mtim.tv_nsec)) +#define ST_CTIME_NSEC(st) ((unsigned int)((st)->st_ctim.tv_nsec)) +#define ST_MTIME_NSEC(st) ((unsigned int)((st)->st_mtim.tv_nsec)) #endif #endif diff --git a/read-cache.c b/read-cache.c index 3f58711..cff85e3 100644 --- a/read-cache.c +++ b/read-cache.c @@ -69,8 +69,8 @@ void fill_stat_cache_info(struct cache_entry *ce, struct stat *st) { ce->ce_ctime.sec = (unsigned int)st->st_ctime; ce->ce_mtime.sec = (unsigned int)st->st_mtime; - ce->ce_ctime.nsec = ST_CTIME_NSEC(*st); - ce->ce_mtime.nsec = ST_MTIME_NSEC(*st); + ce->ce_ctime.nsec = ST_CTIME_NSEC(st); + ce->ce_mtime.nsec = ST_MTIME_NSEC(st); ce->ce_dev = st->st_dev; ce->ce_ino = st->st_ino; ce->ce_uid = st->st_uid; @@ -204,9 +204,9 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st) changed |= CTIME_CHANGED; #ifdef USE_NSEC - if (ce->ce_mtime.nsec != ST_MTIME_NSEC(*st)) + if (ce->ce_mtime.nsec != ST_MTIME_NSEC(st)) changed |= MTIME_CHANGED; - if (trust_ctime && ce->ce_ctime.nsec != ST_CTIME_NSEC(*st)) + if (trust_ctime && ce->ce_ctime.nsec != ST_CTIME_NSEC(st)) changed |= CTIME_CHANGED; #endif @@ -1299,7 +1299,7 @@ int read_index_from(struct index_state *istate, const char *path) dst_offset += ce_size(ce); } istate->timestamp.sec = st.st_mtime; - istate->timestamp.nsec = ST_MTIME_NSEC(st); + istate->timestamp.nsec = ST_MTIME_NSEC(&st); while (src_offset <= mmap_size - 20 - 8) { /* After an array of active_nr index entries, @@ -1564,7 +1564,7 @@ int write_index(struct index_state *istate, int newfd) if (ce_flush(&c, newfd) || fstat(newfd, &st)) return -1; istate->timestamp.sec = (unsigned int)st.st_mtime; - istate->timestamp.nsec = ST_MTIME_NSEC(st); + istate->timestamp.nsec = ST_MTIME_NSEC(&st); return 0; } -- 1.6.2.GIT -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html