clang-tidy: use default member init

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev
2025-05-29 17:06:35 -07:00
committed by Jari Sundell
parent 3ab38583b8
commit 897a6face2
67 changed files with 119 additions and 211 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ command_base::pop_stack(stack_type* stack, torrent::Object* last_stack) {
last_stack->~Object();
// To ensure we catch errors:
std::memset(last_stack, 0xAA, sizeof(torrent::Object));
std::memset((void*)last_stack, 0xAA, sizeof(torrent::Object));
}
}
+2 -4
View File
@@ -20,9 +20,7 @@ struct command_map_data_type {
command_map_data_type(int flags, const char* parm, const char* doc) :
m_flags(flags), m_parm(parm), m_doc(doc) {}
command_map_data_type(const command_map_data_type& src) :
m_variable(src.m_variable), m_anySlot(src.m_anySlot),
m_flags(src.m_flags), m_parm(src.m_parm), m_doc(src.m_doc) {}
command_map_data_type(const command_map_data_type& src) = default;
command_base m_variable;
command_base::any_slot m_anySlot;
@@ -59,7 +57,7 @@ public:
static const int flag_file_target = 0x200;
static const int flag_tracker_target = 0x400;
CommandMap() {}
CommandMap() = default;
bool has(const std::string& key) const { return base_type::find(key) != base_type::end(); }
+1 -1
View File
@@ -24,7 +24,7 @@ public:
using base_type::begin;
using base_type::end;
CommandScheduler() {}
CommandScheduler() = default;
~CommandScheduler();
void set_slot_error_message(SlotString s) { m_slotErrorMessage = s; }
+2 -2
View File
@@ -13,7 +13,7 @@ class CommandSchedulerItem {
public:
typedef std::function<void ()> slot_void;
CommandSchedulerItem(const std::string& key) : m_key(key), m_interval(0) {}
CommandSchedulerItem(const std::string& key) : m_key(key) {}
~CommandSchedulerItem();
bool is_queued() const { return m_task.is_scheduled(); }
@@ -40,7 +40,7 @@ private:
std::string m_key;
torrent::Object m_command;
uint32_t m_interval;
uint32_t m_interval{};
std::chrono::microseconds m_time_scheduled;
torrent::utils::SchedulerEntry m_task;
+1 -3
View File
@@ -15,8 +15,6 @@ public:
static constexpr int flag_capture = 0x4;
static constexpr int flag_background = 0x8;
ExecFile() : m_log_fd(-1) {}
int log_fd() const { return m_log_fd; }
void set_log_fd(int fd) { m_log_fd = fd; }
@@ -24,7 +22,7 @@ public:
torrent::Object execute_object(const torrent::Object& rawArgs, int flags);
private:
int m_log_fd;
int m_log_fd{-1};
std::string m_capture;
};
+1 -1
View File
@@ -24,7 +24,7 @@ class rpc_error : public torrent::base_error {
public:
rpc_error(int type, std::string msg) :
m_type(type), m_msg(msg) {}
virtual ~rpc_error() throw() {}
virtual ~rpc_error() throw() = default;
virtual int type() const throw() { return m_type; }
virtual const char* what() const throw() { return m_msg.c_str(); }
+1 -2
View File
@@ -17,7 +17,6 @@ class SCgi : public torrent::Event {
public:
static const int max_tasks = 100;
SCgi() : m_logFd(-1) {}
~SCgi() override;
const char* type_name() const override { return "scgi"; }
@@ -43,7 +42,7 @@ private:
void open(void* sa, unsigned int length);
std::string m_path;
int m_logFd;
int m_logFd{-1};
SCgiTask m_task[max_tasks];
};
+4 -6
View File
@@ -38,8 +38,6 @@ public:
static void object_to_target(const torrent::Object& obj, int callFlags, rpc::target_type* target);
XmlRpc() : m_env(NULL), m_registry(NULL), m_dialect(dialect_i8), m_sizeLimit(SCgiTask::max_content_size) {}
bool is_valid() const;
void initialize();
@@ -67,14 +65,14 @@ private:
slot_peer m_slotFindPeer;
// Only used by xmlrpc-c
void* m_env;
void* m_registry;
void* m_env{};
void* m_registry{};
int m_dialect;
int m_dialect{dialect_i8};
// Only used by tinyxml2
bool m_isValid;
uint64_t m_sizeLimit;
uint64_t m_sizeLimit{SCgiTask::max_content_size};
};