diff options
| author | Sadie Powell <sadie@witchery.services> | 2022-01-03 18:34:16 +0000 |
|---|---|---|
| committer | Sadie Powell <sadie@witchery.services> | 2022-01-04 00:17:13 +0000 |
| commit | 7531e90499d4cd60b6464c692725225e85c00738 (patch) | |
| tree | 930fd946ea495b74c4071a67e12cadb700ab79ab /modules/database | |
| parent | dfcc025a19d7d49179d75f34553c36e0d47eaded (diff) | |
Use C++11 style class/struct initialisation.
Diffstat (limited to 'modules/database')
| -rw-r--r-- | modules/database/db_flatfile.cpp | 20 | ||||
| -rw-r--r-- | modules/database/db_sql.cpp | 10 |
2 files changed, 13 insertions, 17 deletions
diff --git a/modules/database/db_flatfile.cpp b/modules/database/db_flatfile.cpp index 224adffac..21cb7cc22 100644 --- a/modules/database/db_flatfile.cpp +++ b/modules/database/db_flatfile.cpp @@ -19,9 +19,7 @@ class SaveData : public Serialize::Data { public: Anope::string last; - std::fstream *fs; - - SaveData() : fs(NULL) { } + std::fstream *fs = nullptr; std::iostream& operator[](const Anope::string &key) override { @@ -38,13 +36,11 @@ class SaveData : public Serialize::Data class LoadData : public Serialize::Data { public: - std::fstream *fs; - unsigned int id; + std::fstream *fs = nullptr; + unsigned int id = 0; std::map<Anope::string, Anope::string> data; std::stringstream ss; - bool read; - - LoadData() : fs(NULL), id(0), read(false) { } + bool read = false; std::iostream& operator[](const Anope::string &key) override { @@ -106,12 +102,12 @@ class LoadData : public Serialize::Data class DBFlatFile : public Module, public Pipe { /* Day the last backup was on */ - int last_day; + int last_day = 0; /* Backup file names */ std::map<Anope::string, std::list<Anope::string> > backups; - bool loaded; + bool loaded = false; - int child_pid; + int child_pid = -1; void BackupDatabase() { @@ -172,7 +168,7 @@ class DBFlatFile : public Module, public Pipe } public: - DBFlatFile(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR), last_day(0), loaded(false), child_pid(-1) + DBFlatFile(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR) { } diff --git a/modules/database/db_sql.cpp b/modules/database/db_sql.cpp index 0fa601cfa..0c32310f3 100644 --- a/modules/database/db_sql.cpp +++ b/modules/database/db_sql.cpp @@ -63,10 +63,10 @@ class DBSQL : public Module, public Pipe bool import; std::set<Serializable *> updated_items; - bool shutting_down; - bool loading_databases; - bool loaded; - bool imported; + bool shutting_down = false; + bool loading_databases = false; + bool loaded = false; + bool imported = false; void RunBackground(const Query &q, Interface *iface = NULL) { @@ -90,7 +90,7 @@ class DBSQL : public Module, public Pipe } public: - DBSQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR), sql("", ""), sqlinterface(this), shutting_down(false), loading_databases(false), loaded(false), imported(false) + DBSQL(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABASE | VENDOR), sql("", ""), sqlinterface(this) { |
