aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/common.h
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2016-02-27 19:38:15 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2016-02-27 19:38:15 -0800
commit10f3ea0008a4563c2baa4f29954c285d2d53d7dc (patch)
tree8aedadea55a31de188be16a1ec140cdbc76adba5 /src/common.h
parent88a785e32117081b91b813ac6b5437deb33ef0f7 (diff)
Mark a bunch of constructors as explicit
This prevents undesired implicit conversions
Diffstat (limited to 'src/common.h')
-rw-r--r--src/common.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/common.h b/src/common.h
index ff7443e5..660bc012 100644
--- a/src/common.h
+++ b/src/common.h
@@ -357,7 +357,7 @@ struct string_fuzzy_match_t
size_t match_distance_second;
/* Constructor */
- string_fuzzy_match_t(enum fuzzy_match_type_t t, size_t distance_first = 0, size_t distance_second = 0);
+ explicit string_fuzzy_match_t(enum fuzzy_match_type_t t, size_t distance_first = 0, size_t distance_second = 0);
/* Return -1, 0, 1 if this match is (respectively) better than, equal to, or worse than rhs */
int compare(const string_fuzzy_match_t &rhs) const;
@@ -486,7 +486,7 @@ class null_terminated_array_t
public:
null_terminated_array_t() : array(NULL) { }
- null_terminated_array_t(const string_list_t &argv) : array(make_null_terminated_array(argv))
+ explicit null_terminated_array_t(const string_list_t &argv) : array(make_null_terminated_array(argv))
{
}
@@ -576,8 +576,8 @@ class scoped_lock
public:
void lock(void);
void unlock(void);
- scoped_lock(pthread_mutex_t &mutex);
- scoped_lock(mutex_lock_t &lock);
+ explicit scoped_lock(pthread_mutex_t &mutex);
+ explicit scoped_lock(mutex_lock_t &lock);
~scoped_lock();
};
@@ -607,7 +607,7 @@ class scoped_rwlock
/* No copying */
scoped_rwlock &operator=(const scoped_lock &);
- scoped_rwlock(const scoped_lock &);
+ explicit scoped_rwlock(const scoped_lock &);
public:
void lock(void);
@@ -619,8 +619,8 @@ public:
equivalent to `lock.unlock_shared(); lock.lock();`
*/
void upgrade(void);
- scoped_rwlock(pthread_rwlock_t &rwlock, bool shared = false);
- scoped_rwlock(rwlock_t &rwlock, bool shared = false);
+ explicit scoped_rwlock(pthread_rwlock_t &rwlock, bool shared = false);
+ explicit scoped_rwlock(rwlock_t &rwlock, bool shared = false);
~scoped_rwlock();
};
@@ -639,7 +639,7 @@ class scoped_push
bool restored;
public:
- scoped_push(T *r): ref(r), saved_value(*r), restored(false)
+ explicit scoped_push(T *r): ref(r), saved_value(*r), restored(false)
{
}