1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-21 13:39:09 +00:00

Codechange: Use null pointer literal instead of the NULL macro

This commit is contained in:
Henry Wilson
2019-04-10 22:07:06 +01:00
committed by Michael Lutz
parent 3b4f224c0b
commit 7c8e7c6b6e
463 changed files with 5674 additions and 5674 deletions

View File

@@ -120,14 +120,14 @@ static void debug_print(const char *dbg, const char *buf)
}
if (strcmp(dbg, "desync") == 0) {
static FILE *f = FioFOpenFile("commands-out.log", "wb", AUTOSAVE_DIR);
if (f == NULL) return;
if (f == nullptr) return;
fprintf(f, "%s%s\n", GetLogPrefix(), buf);
fflush(f);
#ifdef RANDOM_DEBUG
} else if (strcmp(dbg, "random") == 0) {
static FILE *f = FioFOpenFile("random-out.log", "wb", AUTOSAVE_DIR);
if (f == NULL) return;
if (f == nullptr) return;
fprintf(f, "%s\n", buf);
fflush(f);
@@ -200,7 +200,7 @@ void SetDebugString(const char *s)
while (*s >= 'a' && *s <= 'z') s++;
/* check debugging levels */
p = NULL;
p = nullptr;
for (i = debug_level; i != endof(debug_level); ++i) {
if (s == t + strlen(i->name) && strncmp(t, i->name, s - t) == 0) {
p = i->level;
@@ -211,7 +211,7 @@ void SetDebugString(const char *s)
if (*s == '=') s++;
v = strtoul(s, &end, 0);
s = end;
if (p != NULL) {
if (p != nullptr) {
*p = v;
} else {
ShowInfoF("Unknown debug level '%.*s'", (int)(s - t), t);
@@ -246,13 +246,13 @@ const char *GetDebugString()
/**
* Get the prefix for logs; if show_date_in_logs is enabled it returns
* the date, otherwise it returns nothing.
* @return the prefix for logs (do not free), never NULL
* @return the prefix for logs (do not free), never nullptr
*/
const char *GetLogPrefix()
{
static char _log_prefix[24];
if (_settings_client.gui.show_date_in_logs) {
time_t cur_time = time(NULL);
time_t cur_time = time(nullptr);
strftime(_log_prefix, sizeof(_log_prefix), "[%Y-%m-%d %H:%M:%S] ", localtime(&cur_time));
} else {
*_log_prefix = '\0';