Skip to content

Commit 3fa9094

Browse files
committed
scripted-diff: Rename FatalError to FatalErrorf
This is done in preparation for the next commit where a new FatalError function is introduced. FatalErrorf follows common convention to append 'f' for functions accepting format arguments. -BEGIN VERIFY SCRIPT- sed -i 's/FatalError/FatalErrorf/g' $( git grep -l 'FatalError') -END VERIFY SCRIPT-
1 parent edb55e2 commit 3fa9094

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/index/base.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ constexpr auto SYNC_LOG_INTERVAL{30s};
3030
constexpr auto SYNC_LOCATOR_WRITE_INTERVAL{30s};
3131

3232
template <typename... Args>
33-
static void FatalError(const char* fmt, const Args&... args)
33+
static void FatalErrorf(const char* fmt, const Args&... args)
3434
{
3535
AbortNode(tfm::format(fmt, args...));
3636
}
@@ -197,7 +197,7 @@ void BaseIndex::ThreadSync()
197197
break;
198198
}
199199
if (pindex_next->pprev != pindex && !Rewind(pindex, pindex_next->pprev)) {
200-
FatalError("%s: Failed to rewind index %s to a previous chain tip",
200+
FatalErrorf("%s: Failed to rewind index %s to a previous chain tip",
201201
__func__, GetName());
202202
return;
203203
}
@@ -221,14 +221,14 @@ void BaseIndex::ThreadSync()
221221
CBlock block;
222222
interfaces::BlockInfo block_info = kernel::MakeBlockInfo(pindex);
223223
if (!m_chainstate->m_blockman.ReadBlockFromDisk(block, *pindex)) {
224-
FatalError("%s: Failed to read block %s from disk",
224+
FatalErrorf("%s: Failed to read block %s from disk",
225225
__func__, pindex->GetBlockHash().ToString());
226226
return;
227227
} else {
228228
block_info.data = &block;
229229
}
230230
if (!CustomAppend(block_info)) {
231-
FatalError("%s: Failed to write block %s to index database",
231+
FatalErrorf("%s: Failed to write block %s to index database",
232232
__func__, pindex->GetBlockHash().ToString());
233233
return;
234234
}
@@ -294,7 +294,7 @@ void BaseIndex::BlockConnected(const std::shared_ptr<const CBlock>& block, const
294294
const CBlockIndex* best_block_index = m_best_block_index.load();
295295
if (!best_block_index) {
296296
if (pindex->nHeight != 0) {
297-
FatalError("%s: First block connected is not the genesis block (height=%d)",
297+
FatalErrorf("%s: First block connected is not the genesis block (height=%d)",
298298
__func__, pindex->nHeight);
299299
return;
300300
}
@@ -312,7 +312,7 @@ void BaseIndex::BlockConnected(const std::shared_ptr<const CBlock>& block, const
312312
return;
313313
}
314314
if (best_block_index != pindex->pprev && !Rewind(best_block_index, pindex->pprev)) {
315-
FatalError("%s: Failed to rewind index %s to a previous chain tip",
315+
FatalErrorf("%s: Failed to rewind index %s to a previous chain tip",
316316
__func__, GetName());
317317
return;
318318
}
@@ -325,7 +325,7 @@ void BaseIndex::BlockConnected(const std::shared_ptr<const CBlock>& block, const
325325
// processed, and the index object being safe to delete.
326326
SetBestBlockIndex(pindex);
327327
} else {
328-
FatalError("%s: Failed to write block %s to index",
328+
FatalErrorf("%s: Failed to write block %s to index",
329329
__func__, pindex->GetBlockHash().ToString());
330330
return;
331331
}
@@ -345,7 +345,7 @@ void BaseIndex::ChainStateFlushed(const CBlockLocator& locator)
345345
}
346346

347347
if (!locator_tip_index) {
348-
FatalError("%s: First block (hash=%s) in locator was not found",
348+
FatalErrorf("%s: First block (hash=%s) in locator was not found",
349349
__func__, locator_tip_hash.ToString());
350350
return;
351351
}

test/lint/lint-format-strings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import sys
1717

1818
FUNCTION_NAMES_AND_NUMBER_OF_LEADING_ARGUMENTS = [
19-
'FatalError,0',
19+
'FatalErrorf,0',
2020
'fprintf,1',
2121
'tfm::format,1', # Assuming tfm::::format(std::ostream&, ...
2222
'LogConnectFailure,1',

test/lint/run-lint-format-strings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
FALSE_POSITIVES = [
1616
("src/dbwrapper.cpp", "vsnprintf(p, limit - p, format, backup_ap)"),
17-
("src/index/base.cpp", "FatalError(const char* fmt, const Args&... args)"),
17+
("src/index/base.cpp", "FatalErrorf(const char* fmt, const Args&... args)"),
1818
("src/netbase.cpp", "LogConnectFailure(bool manual_connection, const char* fmt, const Args&... args)"),
1919
("src/clientversion.cpp", "strprintf(_(COPYRIGHT_HOLDERS).translated, COPYRIGHT_HOLDERS_SUBSTITUTION)"),
2020
("src/test/translation_tests.cpp", "strprintf(format, arg)"),

0 commit comments

Comments
 (0)