summaryrefslogtreecommitdiff
path: root/src/fileops.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-10-31 11:26:12 -0700
committerRussell Belfer <rb@github.com>2012-10-31 11:26:12 -0700
commitc8b511f3cdb3f7fa63600b36bb2412099998a805 (patch)
tree493476084ca1c80ad27e3a00ef4cb7b2334ea7e7 /src/fileops.c
parent744cc03e2b6d77712bfcb504c272d2e646da650c (diff)
downloadlibgit2-c8b511f3cdb3f7fa63600b36bb2412099998a805.tar.gz
Better naming for file timestamp/size checker
Diffstat (limited to 'src/fileops.c')
-rw-r--r--src/fileops.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/fileops.c b/src/fileops.c
index c22622c72..524ba4e77 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -671,27 +671,37 @@ int git_futils_cp_r(
return error;
}
-int git_futils_stat_sig_needs_reload(
- git_futils_stat_sig *sig, const char *path)
+int git_futils_file_stamp_has_changed(
+ git_futils_file_stamp *stamp, const char *path)
{
struct stat st;
- /* if the sig is NULL, then alway reload */
- if (sig == NULL)
+ /* if the stamp is NULL, then always reload */
+ if (stamp == NULL)
return 1;
if (p_stat(path, &st) < 0)
return GIT_ENOTFOUND;
- if ((git_time_t)st.st_mtime == sig->seconds &&
- (git_off_t)st.st_size == sig->size &&
- (unsigned int)st.st_ino == sig->ino)
+ if (stamp->mtime == (git_time_t)st.st_mtime &&
+ stamp->size == (git_off_t)st.st_size &&
+ stamp->ino == (unsigned int)st.st_ino)
return 0;
- sig->seconds = (git_time_t)st.st_mtime;
- sig->size = (git_off_t)st.st_size;
- sig->ino = (unsigned int)st.st_ino;
+ stamp->mtime = (git_time_t)st.st_mtime;
+ stamp->size = (git_off_t)st.st_size;
+ stamp->ino = (unsigned int)st.st_ino;
return 1;
}
+void git_futils_file_stamp_set(
+ git_futils_file_stamp *target, const git_futils_file_stamp *source)
+{
+ assert(target);
+
+ if (source)
+ memcpy(target, source, sizeof(*target));
+ else
+ memset(target, 0, sizeof(*target));
+}