mirror of
https://github.com/transmission/transmission
synced 2024-12-26 01:27:28 +00:00
silence a small handful of minor gcc compiler warnings in libtransmission
This commit is contained in:
parent
765879ddba
commit
0f1f84898b
4 changed files with 29 additions and 28 deletions
|
@ -141,14 +141,8 @@ tr_bandwidthSetParent (tr_bandwidth * b,
|
|||
|
||||
if (b->parent)
|
||||
{
|
||||
void * removed;
|
||||
|
||||
assert (tr_isBandwidth (b->parent));
|
||||
|
||||
removed = tr_ptrArrayRemoveSorted (&b->parent->children, b, compareBandwidth);
|
||||
assert (removed == b);
|
||||
assert (tr_ptrArrayFindSorted (&b->parent->children, b, compareBandwidth) == NULL);
|
||||
|
||||
tr_ptrArrayRemoveSortedPointer (&b->parent->children, b, compareBandwidth);
|
||||
b->parent = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1954,7 +1954,6 @@ myHandshakeDoneCB (tr_handshake * handshake,
|
|||
const tr_address * addr;
|
||||
tr_peerMgr * manager = vmanager;
|
||||
tr_swarm * s;
|
||||
tr_handshake * ours;
|
||||
|
||||
assert (io);
|
||||
assert (tr_isBool (ok));
|
||||
|
@ -1964,16 +1963,11 @@ myHandshakeDoneCB (tr_handshake * handshake,
|
|||
: NULL;
|
||||
|
||||
if (tr_peerIoIsIncoming (io))
|
||||
ours = tr_ptrArrayRemoveSorted (&manager->incomingHandshakes,
|
||||
tr_ptrArrayRemoveSortedPointer (&manager->incomingHandshakes,
|
||||
handshake, handshakeCompare);
|
||||
else if (s)
|
||||
ours = tr_ptrArrayRemoveSorted (&s->outgoingHandshakes,
|
||||
tr_ptrArrayRemoveSortedPointer (&s->outgoingHandshakes,
|
||||
handshake, handshakeCompare);
|
||||
else
|
||||
ours = handshake;
|
||||
|
||||
assert (ours);
|
||||
assert (ours == handshake);
|
||||
|
||||
if (s)
|
||||
swarmLock (s);
|
||||
|
@ -3307,7 +3301,6 @@ getReconnectIntervalSecs (const struct peer_atom * atom, const time_t now)
|
|||
static void
|
||||
removePeer (tr_swarm * s, tr_peer * peer)
|
||||
{
|
||||
tr_peer * removed;
|
||||
struct peer_atom * atom = peer->atom;
|
||||
|
||||
assert (swarmIsLocked (s));
|
||||
|
@ -3315,18 +3308,17 @@ removePeer (tr_swarm * s, tr_peer * peer)
|
|||
|
||||
atom->time = tr_time ();
|
||||
|
||||
removed = tr_ptrArrayRemoveSorted (&s->peers, peer, peerCompare);
|
||||
tr_ptrArrayRemoveSortedPointer (&s->peers, peer, peerCompare);
|
||||
--s->stats.peerCount;
|
||||
--s->stats.peerFromCount[atom->fromFirst];
|
||||
|
||||
if (replicationExists (s))
|
||||
tr_decrReplicationFromBitfield (s, &peer->have);
|
||||
|
||||
assert (removed == peer);
|
||||
assert (s->stats.peerCount == tr_ptrArraySize (&s->peers));
|
||||
assert (s->stats.peerFromCount[atom->fromFirst] >= 0);
|
||||
|
||||
tr_peerFree (removed);
|
||||
tr_peerFree (peer);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -215,8 +215,8 @@ tr_ptrArrayFindSorted (tr_ptrArray * t,
|
|||
return match ? t->items[pos] : NULL;
|
||||
}
|
||||
|
||||
void*
|
||||
tr_ptrArrayRemoveSorted (tr_ptrArray * t,
|
||||
static void*
|
||||
tr_ptrArrayRemoveSortedValue (tr_ptrArray * t,
|
||||
const void * ptr,
|
||||
int compare (const void*, const void*))
|
||||
{
|
||||
|
@ -238,3 +238,18 @@ tr_ptrArrayRemoveSorted (tr_ptrArray * t,
|
|||
assert ((ret == NULL) || (compare (ret, ptr) == 0));
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
tr_ptrArrayRemoveSortedPointer (tr_ptrArray * t,
|
||||
const void * ptr,
|
||||
int compare (const void*, const void*))
|
||||
{
|
||||
#ifdef NDEBUG
|
||||
tr_ptrArrayRemoveSortedValue (t, ptr, compare);
|
||||
#else
|
||||
void * removed = tr_ptrArrayRemoveSortedValue (t, ptr, compare);
|
||||
assert (removed != NULL);
|
||||
assert (removed == ptr);
|
||||
assert (tr_ptrArrayFindSorted (t, ptr, compare) == NULL);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -130,12 +130,12 @@ int tr_ptrArrayInsertSorted (tr_ptrArray * array,
|
|||
void * value,
|
||||
int compare (const void*, const void*));
|
||||
|
||||
/** @brief Remove a pointer from an array sorted by the specified sort function
|
||||
@return the matching pointer, or NULL if no match was found */
|
||||
void* tr_ptrArrayRemoveSorted (tr_ptrArray * array,
|
||||
const void * value,
|
||||
/** @brief Remove this specific pointer from a sorted ptrarray */
|
||||
void tr_ptrArrayRemoveSortedPointer (tr_ptrArray * t,
|
||||
const void * ptr,
|
||||
int compare (const void*, const void*));
|
||||
|
||||
|
||||
/** @brief Find a pointer from an array sorted by the specified sort function
|
||||
@return the matching pointer, or NULL if no match was found */
|
||||
void* tr_ptrArrayFindSorted (tr_ptrArray * array,
|
||||
|
|
Loading…
Reference in a new issue