summaryrefslogtreecommitdiff
path: root/modules/extra
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2022-01-03 18:34:16 +0000
committerSadie Powell <sadie@witchery.services>2022-01-04 00:17:13 +0000
commit7531e90499d4cd60b6464c692725225e85c00738 (patch)
tree930fd946ea495b74c4071a67e12cadb700ab79ab /modules/extra
parentdfcc025a19d7d49179d75f34553c36e0d47eaded (diff)
Use C++11 style class/struct initialisation.
Diffstat (limited to 'modules/extra')
-rw-r--r--modules/extra/m_ldap.cpp13
-rw-r--r--modules/extra/m_ldap_authentication.cpp4
-rw-r--r--modules/extra/m_mysql.cpp8
-rw-r--r--modules/extra/m_sqlite.cpp4
-rw-r--r--modules/extra/m_ssl_gnutls.cpp16
5 files changed, 20 insertions, 25 deletions
diff --git a/modules/extra/m_ldap.cpp b/modules/extra/m_ldap.cpp
index e9182d7d9..b72c9af56 100644
--- a/modules/extra/m_ldap.cpp
+++ b/modules/extra/m_ldap.cpp
@@ -29,18 +29,15 @@ class LDAPRequest
public:
LDAPService *service;
LDAPInterface *inter;
- LDAPMessage *message; /* message returned by ldap_ */
- LDAPResult *result; /* final result */
+ LDAPMessage *message = nullptr; /* message returned by ldap_ */
+ LDAPResult *result = nullptr; /* final result */
struct timeval tv;
- QueryType type;
+ QueryType type = QUERY_UNKNOWN;
LDAPRequest(LDAPService *s, LDAPInterface *i)
: service(s)
, inter(i)
- , message(NULL)
- , result(NULL)
{
- type = QUERY_UNKNOWN;
tv.tv_sec = 0;
tv.tv_usec = 100000;
}
@@ -147,7 +144,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
LDAP *con;
- time_t last_connect;
+ time_t last_connect = 0;
public:
static LDAPMod **BuildMods(const LDAPMods &attributes)
@@ -232,7 +229,7 @@ class LDAPService : public LDAPProvider, public Thread, public Condition
query_queue queries, results;
Mutex process_mutex; /* held when processing requests not in either queue */
- LDAPService(Module *o, const Anope::string &n, const Anope::string &s, const Anope::string &b, const Anope::string &p) : LDAPProvider(o, n), server(s), admin_binddn(b), admin_pass(p), last_connect(0)
+ LDAPService(Module *o, const Anope::string &n, const Anope::string &s, const Anope::string &b, const Anope::string &p) : LDAPProvider(o, n), server(s), admin_binddn(b), admin_pass(p)
{
Connect();
}
diff --git a/modules/extra/m_ldap_authentication.cpp b/modules/extra/m_ldap_authentication.cpp
index cac2035a0..ab67bd919 100644
--- a/modules/extra/m_ldap_authentication.cpp
+++ b/modules/extra/m_ldap_authentication.cpp
@@ -22,10 +22,10 @@ struct IdentifyInfo
Reference<User> user;
IdentifyRequest *req;
ServiceReference<LDAPProvider> lprov;
- bool admin_bind;
+ bool admin_bind = true;
Anope::string dn;
- IdentifyInfo(User *u, IdentifyRequest *r, ServiceReference<LDAPProvider> &lp) : user(u), req(r), lprov(lp), admin_bind(true)
+ IdentifyInfo(User *u, IdentifyRequest *r, ServiceReference<LDAPProvider> &lp) : user(u), req(r), lprov(lp)
{
req->Hold(me);
}
diff --git a/modules/extra/m_mysql.cpp b/modules/extra/m_mysql.cpp
index fb9e4888f..3b4b0ea3f 100644
--- a/modules/extra/m_mysql.cpp
+++ b/modules/extra/m_mysql.cpp
@@ -61,7 +61,7 @@ struct QueryResult
*/
class MySQLResult : public Result
{
- MYSQL_RES *res;
+ MYSQL_RES *res = nullptr;
public:
MySQLResult(unsigned int i, const Query &q, const Anope::string &fq, MYSQL_RES *r) : Result(i, q, fq), res(r)
@@ -94,7 +94,7 @@ class MySQLResult : public Result
}
}
- MySQLResult(const Query &q, const Anope::string &fq, const Anope::string &err) : Result(0, q, fq, err), res(NULL)
+ MySQLResult(const Query &q, const Anope::string &fq, const Anope::string &err) : Result(0, q, fq, err)
{
}
@@ -117,7 +117,7 @@ class MySQLService : public Provider
Anope::string password;
int port;
- MYSQL *sql;
+ MYSQL *sql = nullptr;
/** Escape a query.
* Note the mutex must be held!
@@ -300,7 +300,7 @@ class ModuleSQL : public Module, public Pipe
};
MySQLService::MySQLService(Module *o, const Anope::string &n, const Anope::string &d, const Anope::string &s, const Anope::string &u, const Anope::string &p, int po)
-: Provider(o, n), database(d), server(s), user(u), password(p), port(po), sql(NULL)
+: Provider(o, n), database(d), server(s), user(u), password(p), port(po)
{
Connect();
}
diff --git a/modules/extra/m_sqlite.cpp b/modules/extra/m_sqlite.cpp
index 39dad2f02..1a2bed1f1 100644
--- a/modules/extra/m_sqlite.cpp
+++ b/modules/extra/m_sqlite.cpp
@@ -44,7 +44,7 @@ class SQLiteService : public Provider
Anope::string database;
- sqlite3 *sql;
+ sqlite3 *sql = nullptr;
Anope::string Escape(const Anope::string &query);
@@ -134,7 +134,7 @@ class ModuleSQLite : public Module
};
SQLiteService::SQLiteService(Module *o, const Anope::string &n, const Anope::string &d)
-: Provider(o, n), database(d), sql(NULL)
+: Provider(o, n), database(d)
{
int db = sqlite3_open_v2(database.c_str(), &this->sql, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0);
if (db != SQLITE_OK)
diff --git a/modules/extra/m_ssl_gnutls.cpp b/modules/extra/m_ssl_gnutls.cpp
index 18c561266..c6b532269 100644
--- a/modules/extra/m_ssl_gnutls.cpp
+++ b/modules/extra/m_ssl_gnutls.cpp
@@ -36,7 +36,7 @@ class MySSLService : public SSLService
class SSLSocketIO : public SocketIO
{
public:
- gnutls_session_t sess;
+ gnutls_session_t sess = nullptr;
GnuTLS::X509CertCredentials* mycreds;
/** Constructor
@@ -115,11 +115,9 @@ namespace GnuTLS
class DHParams
{
- gnutls_dh_params_t dh_params;
+ gnutls_dh_params_t dh_params = nullptr;
public:
- DHParams() : dh_params(NULL) { }
-
void Import(const Anope::string &dhstr)
{
if (dh_params != NULL)
@@ -225,7 +223,7 @@ namespace GnuTLS
class X509CertCredentials
{
- unsigned int refcount;
+ unsigned int refcount = 0;
gnutls_certificate_credentials_t cred;
DHParams dh;
@@ -247,7 +245,7 @@ namespace GnuTLS
X509Key key;
X509CertCredentials(const Anope::string &certfile, const Anope::string &keyfile)
- : refcount(0), certs(LoadFile(certfile)), key(LoadFile(keyfile))
+ : certs(LoadFile(certfile)), key(LoadFile(keyfile))
{
if (gnutls_certificate_allocate_credentials(&cred) < 0)
throw ConfigException("Cannot allocate certificate credentials");
@@ -299,10 +297,10 @@ class GnuTLSModule : public Module
GnuTLS::Init libinit;
public:
- GnuTLS::X509CertCredentials *cred;
+ GnuTLS::X509CertCredentials *cred = nullptr;
MySSLService service;
- GnuTLSModule(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, EXTRA | VENDOR), cred(NULL), service(this, "ssl")
+ GnuTLSModule(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, EXTRA | VENDOR), service(this, "ssl")
{
me = this;
this->SetPermanent(true);
@@ -630,7 +628,7 @@ void SSLSocketIO::Destroy()
delete this;
}
-SSLSocketIO::SSLSocketIO() : sess(NULL), mycreds(me->cred)
+SSLSocketIO::SSLSocketIO() : mycreds(me->cred)
{
mycreds->incrref();
}