Give file_id_t a real constructor

Initialize it to invalid by default.
This commit is contained in:
ridiculousfish 2021-05-02 13:55:41 -07:00
parent c435d8b9b3
commit 8344289fac
2 changed files with 10 additions and 14 deletions

View file

@ -31,13 +31,7 @@
using cstring = std::string; using cstring = std::string;
const file_id_t kInvalidFileID = {static_cast<dev_t>(-1LL), const file_id_t kInvalidFileID{};
static_cast<ino_t>(-1LL),
static_cast<uint64_t>(-1LL),
-1,
-1,
-1,
-1};
/// Map used as cache by wgettext. /// Map used as cache by wgettext.
static owning_lock<std::unordered_map<wcstring, wcstring>> wgettext_map; static owning_lock<std::unordered_map<wcstring, wcstring>> wgettext_map;

View file

@ -137,13 +137,15 @@ double fish_wcstod(const wchar_t *str, wchar_t **endptr);
/// seems to aggressively re-use inodes, so it cannot determine if a file has been deleted (ABA /// seems to aggressively re-use inodes, so it cannot determine if a file has been deleted (ABA
/// problem). Therefore we include richer information. /// problem). Therefore we include richer information.
struct file_id_t { struct file_id_t {
dev_t device; dev_t device{static_cast<dev_t>(-1LL)};
ino_t inode; ino_t inode{static_cast<ino_t>(-1LL)};
uint64_t size; uint64_t size{static_cast<uint64_t>(-1LL)};
time_t change_seconds; time_t change_seconds{-1};
long change_nanoseconds; long change_nanoseconds{-1};
time_t mod_seconds; time_t mod_seconds{-1};
long mod_nanoseconds; long mod_nanoseconds{-1};
constexpr file_id_t() = default;
bool operator==(const file_id_t &rhs) const; bool operator==(const file_id_t &rhs) const;
bool operator!=(const file_id_t &rhs) const; bool operator!=(const file_id_t &rhs) const;