[clang-tidy] change several member functions to const

Found with readability-make-member-function-const

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2020-04-02 19:39:29 -07:00 committed by Fabian Homborg
parent 312b575424
commit 473a5250ae
10 changed files with 10 additions and 10 deletions

View file

@ -1,5 +1,5 @@
---
Checks: 'clang-diagnostic-*,clang-analyzer-*,cert-*,performance-*,portability-*,modernize-use-auto,modernize-loop-convert,modernize-use-bool-literals,modernize-use-using,hicpp-uppercase-literal-suffix'
Checks: 'clang-diagnostic-*,clang-analyzer-*,cert-*,performance-*,portability-*,modernize-use-auto,modernize-loop-convert,modernize-use-bool-literals,modernize-use-using,hicpp-uppercase-literal-suffix,readability-make-member-function-const'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false

View file

@ -1288,7 +1288,7 @@ class universal_notifier_named_pipe_t : public universal_notifier_t {
void make_pipe(const wchar_t *test_path);
void drain_excessive_data() {
void drain_excessive_data() const {
// The pipe seems to have data on it, that won't go away. Read a big chunk out of it. We
// don't read until it's exhausted, because if someone were to pipe say /dev/null, that
// would cause us to hang!

View file

@ -161,7 +161,7 @@ history_item_t history_file_contents_t::decode_item(size_t offset) const {
return history_item_t{};
}
maybe_t<size_t> history_file_contents_t::offset_of_next_item(size_t *cursor, time_t cutoff) {
maybe_t<size_t> history_file_contents_t::offset_of_next_item(size_t *cursor, time_t cutoff) const {
auto offset = size_t(-1);
switch (this->type()) {
case history_type_fish_2_0:

View file

@ -29,7 +29,7 @@ class history_file_contents_t {
/// The cursor should initially be 0.
/// If cutoff is nonzero, skip items whose timestamp is newer than cutoff.
/// \return the offset of the next item, or none() on end.
maybe_t<size_t> offset_of_next_item(size_t *cursor, time_t cutoff);
maybe_t<size_t> offset_of_next_item(size_t *cursor, time_t cutoff) const;
/// Get the file type.
history_file_type_t type() const { return type_; }

View file

@ -407,7 +407,7 @@ bool sigint_checker_t::check() {
return changed;
}
void sigint_checker_t::wait() {
void sigint_checker_t::wait() const {
auto &tm = topic_monitor_t::principal();
generation_list_t gens{};
gens[topic_t::sighupint] = this->gen_;

View file

@ -45,7 +45,7 @@ class sigint_checker_t {
bool check();
/// Wait until a sigint is delivered.
void wait();
void wait() const;
};
#endif

View file

@ -302,7 +302,7 @@ void wgetopter_t::_update_long_opt(int argc, wchar_t **argv, const struct woptio
// Find a matching long opt.
const struct woption *wgetopter_t::_find_matching_long_opt(const struct woption *longopts,
wchar_t *nameend, int *exact, int *ambig,
int *indfound) {
int *indfound) const {
const struct woption *pfound = nullptr;
int option_index = 0;

View file

@ -54,7 +54,7 @@ class wgetopter_t {
bool _handle_long_opt(int argc, wchar_t **argv, const struct woption *longopts, int *longind,
int long_only, int *retval);
const struct woption *_find_matching_long_opt(const struct woption *longopts, wchar_t *nameend,
int *exact, int *ambig, int *indfound);
int *exact, int *ambig, int *indfound) const;
void _update_long_opt(int argc, wchar_t **argv, const struct woption *pfound, wchar_t *nameend,
int *longind, int option_index, int *retval);
bool initialized = false;

View file

@ -206,7 +206,7 @@ dir_t::~dir_t() {
bool dir_t::valid() const { return this->dir != nullptr; }
bool dir_t::read(wcstring &name) { return wreaddir(this->dir, name); }
bool dir_t::read(wcstring &name) const { return wreaddir(this->dir, name); }
int wstat(const wcstring &file_name, struct stat *buf) {
const cstring tmp = wcs2string(file_name);

View file

@ -173,7 +173,7 @@ struct file_id_t {
struct dir_t {
DIR *dir;
bool valid() const;
bool read(wcstring &name);
bool read(wcstring &name) const;
dir_t(const wcstring &path);
~dir_t();
};