* Wrap everything related to *stat() into own functions

* Testwise remove early includes to stdin for OSX, see if they are still required
This commit is contained in:
jsteube
2016-10-31 11:28:06 +01:00
parent 80b3f52952
commit 93adde9d2f
23 changed files with 107 additions and 147 deletions
+1
View File
@@ -23,6 +23,7 @@
#define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64
#define _LARGEFILE64_SOURCE
#define NOMINMAX 1
+3
View File
@@ -31,4 +31,7 @@ void setup_environment_variables (void);
void setup_umask (void);
void setup_seeding (const bool rp_gen_seed_chgd, const u32 rp_gen_seed);
int hc_stat (const char *pathname, hc_stat_t *buf);
int hc_fstat (int fd, hc_stat_t *buf);
#endif // _SHARED_H
+5 -20
View File
@@ -15,6 +15,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
#if defined (_WIN)
#include <windows.h>
@@ -61,15 +62,11 @@ typedef pthread_mutex_t hc_thread_mutex_t;
// stat
#if defined (_POSIX)
typedef struct stat hc_stat;
typedef struct stat hc_stat_t;
#endif
#if defined (_WIN)
#if defined (_MSC_VER)
typedef struct _stat64 hc_stat;
#else
typedef struct stat64 hc_stat;
#endif
typedef struct _stat64 hc_stat_t;
#endif
// enums
@@ -1119,13 +1116,7 @@ typedef struct dictstat
{
u64 cnt;
#if defined (_POSIX)
struct stat stat;
#endif
#if defined (_WIN)
struct __stat64 stat;
#endif
hc_stat_t stat;
} dictstat_t;
@@ -1635,13 +1626,7 @@ typedef struct cache_hit
{
char *dictfile;
#if defined (_POSIX)
struct stat stat;
#endif
#if defined (_WIN)
struct __stat64 stat;
#endif
hc_stat_t stat;
u64 cached_cnt;
u64 keyspace;