mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-04 08:51:00 +02:00
lint/format-strings: Correctly exclude escaped percent symbols
This commit is contained in:
parent
7a30e0f6c5
commit
57281199b8
@ -241,12 +241,11 @@ def count_format_specifiers(format_string):
|
||||
4
|
||||
"""
|
||||
assert(type(format_string) is str)
|
||||
format_string = format_string.replace('%%', 'X')
|
||||
n = 0
|
||||
in_specifier = False
|
||||
for i, char in enumerate(format_string):
|
||||
if format_string[i - 1:i + 1] == "%%" or format_string[i:i + 2] == "%%":
|
||||
pass
|
||||
elif char == "%":
|
||||
if char == "%":
|
||||
in_specifier = True
|
||||
n += 1
|
||||
elif char in "aAcdeEfFgGinopsuxX":
|
||||
|
Loading…
x
Reference in New Issue
Block a user