summaryrefslogtreecommitdiff
path: root/src/driver.cpp
diff options
context:
space:
mode:
authorHenry Wilson <m3henry@googlemail.com>2019-04-10 22:07:06 +0100
committerMichael Lutz <michi@icosahedron.de>2019-04-10 23:22:20 +0200
commit7c8e7c6b6e16d4a26259a676db32d8776b99817e (patch)
tree99f134b7e66367cf11e10bc5061896eab4a3264f /src/driver.cpp
parent3b4f224c0bc50e7248050d4bcbb6d83fd510c1cc (diff)
downloadopenttd-7c8e7c6b6e16d4a26259a676db32d8776b99817e.tar.xz
Codechange: Use null pointer literal instead of the NULL macro
Diffstat (limited to 'src/driver.cpp')
-rw-r--r--src/driver.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/driver.cpp b/src/driver.cpp
index 825c489b9..390fb381e 100644
--- a/src/driver.cpp
+++ b/src/driver.cpp
@@ -41,10 +41,10 @@ const char *GetDriverParam(const char * const *parm, const char *name)
{
size_t len;
- if (parm == NULL) return NULL;
+ if (parm == nullptr) return nullptr;
len = strlen(name);
- for (; *parm != NULL; parm++) {
+ for (; *parm != nullptr; parm++) {
const char *p = *parm;
if (strncmp(p, name, len) == 0) {
@@ -52,7 +52,7 @@ const char *GetDriverParam(const char * const *parm, const char *name)
if (p[len] == '\0') return p + len;
}
}
- return NULL;
+ return nullptr;
}
/**
@@ -63,7 +63,7 @@ const char *GetDriverParam(const char * const *parm, const char *name)
*/
bool GetDriverParamBool(const char * const *parm, const char *name)
{
- return GetDriverParam(parm, name) != NULL;
+ return GetDriverParam(parm, name) != nullptr;
}
/**
@@ -76,7 +76,7 @@ bool GetDriverParamBool(const char * const *parm, const char *name)
int GetDriverParamInt(const char * const *parm, const char *name, int def)
{
const char *p = GetDriverParam(parm, name);
- return p != NULL ? atoi(p) : def;
+ return p != nullptr ? atoi(p) : def;
}
/**
@@ -120,8 +120,8 @@ bool DriverFactoryBase::SelectDriverImpl(const char *name, Driver::Type type)
Driver *newd = d->CreateInstance();
*GetActiveDriver(type) = newd;
- const char *err = newd->Start(NULL);
- if (err == NULL) {
+ const char *err = newd->Start(nullptr);
+ if (err == nullptr) {
DEBUG(driver, 1, "Successfully probed %s driver '%s'", GetDriverTypeName(type), d->name);
delete oldd;
return true;
@@ -141,8 +141,8 @@ bool DriverFactoryBase::SelectDriverImpl(const char *name, Driver::Type type)
/* Extract the driver name and put parameter list in parm */
strecpy(buffer, name, lastof(buffer));
parm = strchr(buffer, ':');
- parms[0] = NULL;
- if (parm != NULL) {
+ parms[0] = nullptr;
+ if (parm != nullptr) {
uint np = 0;
/* Tokenize the parm. */
do {
@@ -150,7 +150,7 @@ bool DriverFactoryBase::SelectDriverImpl(const char *name, Driver::Type type)
if (np < lengthof(parms) - 1) parms[np++] = parm;
while (*parm != '\0' && *parm != ',') parm++;
} while (*parm == ',');
- parms[np] = NULL;
+ parms[np] = nullptr;
}
/* Find this driver */
@@ -168,7 +168,7 @@ bool DriverFactoryBase::SelectDriverImpl(const char *name, Driver::Type type)
Driver *newd = d->CreateInstance();
const char *err = newd->Start(parms);
- if (err != NULL) {
+ if (err != nullptr) {
delete newd;
usererror("Unable to load driver '%s'. The error was: %s", d->name, err);
}