mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge #13577: logging: avoid nStart may be used uninitialized in AppInitMain warning
2dcd7b4ec logging: avoid nStart may be used uninitialized in AppInitMain warning (mruddy) Pull request description: Was getting the following compiler warning: ``` init.cpp: In function ‘bool AppInitMain()’: init.cpp:1616:60: warning: ‘nStart’ may be used uninitialized in this function [-Wmaybe-uninitialized] LogPrintf(" block index %15dms\n", GetTimeMillis() - nStart); ``` It's ok without this PR, but this PR renames `nStart` to `load_block_index_start_time`, makes it `const`, and also reduces the scope of the variable. The logging line is moved such that the the time spent will be logged even if a shutdown is requested while the index is being loaded. Having the log message output even when a shutdown is requested may be how this was intended to work before anyways. That could explain the leading space, as such a log message now looks like: ``` 2018-06-30T11:34:05Z [0%]...[16%]...[33%]...[50%]... block index 25750ms 2018-06-30T11:34:17Z Shutdown requested. Exiting. ``` Tree-SHA512: 967048afbc31f2ce8f80ae7d33fee0bdcbe94550cf2b5b662087e2a7cff14a8bf43d909b30f930660c184ec6c3c7e1302a84e3e54fc1723f7412827f4bf2c518
This commit is contained in:
parent
2b8be8f873
commit
d3a000fb39
@ -1840,8 +1840,8 @@ bool AppInitMain()
|
||||
|
||||
uiInterface.InitMessage(_("Loading block index..."));
|
||||
|
||||
nStart = GetTimeMillis();
|
||||
do {
|
||||
const int64_t load_block_index_start_time = GetTimeMillis();
|
||||
try {
|
||||
UnloadBlockIndex();
|
||||
pcoinsTip.reset();
|
||||
@ -2007,6 +2007,7 @@ bool AppInitMain()
|
||||
}
|
||||
|
||||
fLoaded = true;
|
||||
LogPrintf(" block index %15dms\n", GetTimeMillis() - load_block_index_start_time);
|
||||
} while(false);
|
||||
|
||||
if (!fLoaded && !fRequestShutdown) {
|
||||
@ -2037,9 +2038,6 @@ bool AppInitMain()
|
||||
LogPrintf("Shutdown requested. Exiting.\n");
|
||||
return false;
|
||||
}
|
||||
if (fLoaded) {
|
||||
LogPrintf(" block index %15dms\n", GetTimeMillis() - nStart);
|
||||
}
|
||||
|
||||
fs::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME;
|
||||
CAutoFile est_filein(fsbridge::fopen(est_path, "rb"), SER_DISK, CLIENT_VERSION);
|
||||
|
Loading…
Reference in New Issue
Block a user