mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 12:28:52 +00:00
refactor: cppcoreguidelines-init-variables pt. 13 (#2043)
* refactor: fix uninit var warnings in ptrarray * refactor: fix uninit var warnings in bitfield * refactor: fix uninit var warnings in handshake * refactor: fix uninit var warnings in tr-dht * refactor: fix uninit var warnings in natpmp Co-authored-by: Mike Gelfand <mikedld@users.noreply.github.com>
This commit is contained in:
@@ -200,12 +200,10 @@ static void assertIndexIsSortedAndUnique(tr_ptrArray const* t, int pos, tr_voidp
|
||||
|
||||
int tr_ptrArrayInsertSorted(tr_ptrArray* t, void* ptr, tr_voidptr_compare_func compare)
|
||||
{
|
||||
int pos;
|
||||
int ret;
|
||||
assertArrayIsSortedAndUnique(t, compare);
|
||||
|
||||
pos = tr_ptrArrayLowerBound(t, ptr, compare, nullptr);
|
||||
ret = tr_ptrArrayInsert(t, ptr, pos);
|
||||
int const pos = tr_ptrArrayLowerBound(t, ptr, compare, nullptr);
|
||||
int const ret = tr_ptrArrayInsert(t, ptr, pos);
|
||||
|
||||
assertIndexIsSortedAndUnique(t, ret, compare);
|
||||
return ret;
|
||||
@@ -220,13 +218,12 @@ void* tr_ptrArrayFindSorted(tr_ptrArray* t, void const* ptr, tr_voidptr_compare_
|
||||
|
||||
static void* tr_ptrArrayRemoveSortedValue(tr_ptrArray* t, void const* ptr, tr_voidptr_compare_func compare)
|
||||
{
|
||||
int pos;
|
||||
bool match;
|
||||
void* ret = nullptr;
|
||||
|
||||
assertArrayIsSortedAndUnique(t, compare);
|
||||
|
||||
pos = tr_ptrArrayLowerBound(t, ptr, compare, &match);
|
||||
bool match = false;
|
||||
int const pos = tr_ptrArrayLowerBound(t, ptr, compare, &match);
|
||||
|
||||
if (match)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user