From e923c2943569405203979377c38014abaa1343b6 Mon Sep 17 00:00:00 2001 From: jsteube Date: Thu, 8 Sep 2016 18:56:33 +0200 Subject: [PATCH] Add missing sources --- include/dictstat.h | 33 +++++++++++++++++++++++++++++++++ src/dictstat.c | 22 ++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 include/dictstat.h create mode 100644 src/dictstat.c diff --git a/include/dictstat.h b/include/dictstat.h new file mode 100644 index 000000000..62c98df4a --- /dev/null +++ b/include/dictstat.h @@ -0,0 +1,33 @@ +/** + * Author......: Jens Steube + * License.....: MIT + */ + +#ifndef _DICTSTAT_H +#define _DICTSTAT_H + +#include +#include +#include +#include +#include + +#define MAX_DICTSTAT 10000 + +typedef struct +{ + u64 cnt; + + #if defined (_POSIX) + struct stat stat; + #endif + + #if defined (_WIN) + struct __stat64 stat; + #endif + +} dictstat_t; + +int sort_by_dictstat (const void *s1, const void *s2); + +#endif // _DICTSTAT_H diff --git a/src/dictstat.c b/src/dictstat.c new file mode 100644 index 000000000..b8bf05613 --- /dev/null +++ b/src/dictstat.c @@ -0,0 +1,22 @@ +/** + * Author......: Jens Steube + * License.....: MIT + */ + +#include "common.h" +#include "types_int.h" +#include "dictstat.h" + +int sort_by_dictstat (const void *s1, const void *s2) +{ + dictstat_t *d1 = (dictstat_t *) s1; + dictstat_t *d2 = (dictstat_t *) s2; + + #if defined (__linux__) + d2->stat.st_atim = d1->stat.st_atim; + #else + d2->stat.st_atime = d1->stat.st_atime; + #endif + + return memcmp (&d1->stat, &d2->stat, sizeof (struct stat)); +}