Project

General

Profile

Feature #2092 ยป 0031-mpdb.c-Replace-NULL-with-nullptr.patch

Marko Lindqvist, 07/26/2026 11:30 AM

View differences:

tools/fcmp/mpdb.c
#define MPDB_FORMAT_VERSION "1"
static sqlite3 *main_handle = NULL;
static sqlite3 *scenario_handle = NULL;
static sqlite3 *main_handle = nullptr;
static sqlite3 *scenario_handle = nullptr;
static int mpdb_query(sqlite3 *handle, const char *query);
......
file = secfile_load(filename, FALSE);
if (file == NULL) {
if (file == nullptr) {
/* This happens in first run - or actually all runs until something is
* installed. Previous run has not saved database. */
log_debug("No install info file");
......
caps = secfile_lookup_str(file, "info.options");
if (caps == NULL) {
if (caps == nullptr) {
log_error("MPDB %s missing capability information", filename);
secfile_destroy(file);
return;
......
return;
}
if (file != NULL) {
if (file != nullptr) {
bool all_read = FALSE;
int i;
......
fc_snprintf(buf, sizeof(buf), "modpacks.mp%d", i);
str = secfile_lookup_str_default(file, NULL, "%s.name", buf);
str = secfile_lookup_str_default(file, nullptr, "%s.name", buf);
if (str != NULL) {
if (str != nullptr) {
const char *type;
const char *ver;
......
int ret;
sqlite3_stmt *stmt;
ret = sqlite3_prepare_v2(handle, query, -1, &stmt, NULL);
ret = sqlite3_prepare_v2(handle, query, -1, &stmt, nullptr);
if (ret == SQLITE_OK) {
ret = sqlite3_step(stmt);
......
}
ret = sqlite3_open_v2(filename, handle, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
NULL);
nullptr);
if (ret == SQLITE_OK) {
ret = mpdb_query(*handle,
......
handle = &main_handle;
}
ret = sqlite3_open_v2(filename, handle, SQLITE_OPEN_READWRITE, NULL);
ret = sqlite3_open_v2(filename, handle, SQLITE_OPEN_READWRITE, nullptr);
if (ret != SQLITE_OK) {
log_error(_("Opening \"%s\" failed: %s"), filename, sqlite3_errstr(ret));
......
void close_mpdbs(void)
{
sqlite3_close(main_handle);
main_handle = NULL;
main_handle = nullptr;
sqlite3_close(scenario_handle);
scenario_handle = NULL;
scenario_handle = nullptr;
}
/**********************************************************************//**
......
sqlite3_snprintf(sizeof(qbuf), qbuf,
"select * from modpacks where name is '%q';",
name);
ret = sqlite3_prepare_v2(*handle, qbuf, -1, &stmt, NULL);
ret = sqlite3_prepare_v2(*handle, qbuf, -1, &stmt, nullptr);
if (ret == SQLITE_OK) {
ret = sqlite3_step(stmt);
......
return (const char *)sqlite3_column_text(stmt, 2);
}
return NULL;
return nullptr;
}
    (1-1/1)