mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +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)
|
if (b->parent)
|
||||||
{
|
{
|
||||||
void * removed;
|
|
||||||
|
|
||||||
assert (tr_isBandwidth (b->parent));
|
assert (tr_isBandwidth (b->parent));
|
||||||
|
tr_ptrArrayRemoveSortedPointer (&b->parent->children, b, compareBandwidth);
|
||||||
removed = tr_ptrArrayRemoveSorted (&b->parent->children, b, compareBandwidth);
|
|
||||||
assert (removed == b);
|
|
||||||
assert (tr_ptrArrayFindSorted (&b->parent->children, b, compareBandwidth) == NULL);
|
|
||||||
|
|
||||||
b->parent = NULL;
|
b->parent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1954,7 +1954,6 @@ myHandshakeDoneCB (tr_handshake * handshake,
|
||||||
const tr_address * addr;
|
const tr_address * addr;
|
||||||
tr_peerMgr * manager = vmanager;
|
tr_peerMgr * manager = vmanager;
|
||||||
tr_swarm * s;
|
tr_swarm * s;
|
||||||
tr_handshake * ours;
|
|
||||||
|
|
||||||
assert (io);
|
assert (io);
|
||||||
assert (tr_isBool (ok));
|
assert (tr_isBool (ok));
|
||||||
|
@ -1964,16 +1963,11 @@ myHandshakeDoneCB (tr_handshake * handshake,
|
||||||
: NULL;
|
: NULL;
|
||||||
|
|
||||||
if (tr_peerIoIsIncoming (io))
|
if (tr_peerIoIsIncoming (io))
|
||||||
ours = tr_ptrArrayRemoveSorted (&manager->incomingHandshakes,
|
tr_ptrArrayRemoveSortedPointer (&manager->incomingHandshakes,
|
||||||
handshake, handshakeCompare);
|
handshake, handshakeCompare);
|
||||||
else if (s)
|
else if (s)
|
||||||
ours = tr_ptrArrayRemoveSorted (&s->outgoingHandshakes,
|
tr_ptrArrayRemoveSortedPointer (&s->outgoingHandshakes,
|
||||||
handshake, handshakeCompare);
|
handshake, handshakeCompare);
|
||||||
else
|
|
||||||
ours = handshake;
|
|
||||||
|
|
||||||
assert (ours);
|
|
||||||
assert (ours == handshake);
|
|
||||||
|
|
||||||
if (s)
|
if (s)
|
||||||
swarmLock (s);
|
swarmLock (s);
|
||||||
|
@ -3307,7 +3301,6 @@ getReconnectIntervalSecs (const struct peer_atom * atom, const time_t now)
|
||||||
static void
|
static void
|
||||||
removePeer (tr_swarm * s, tr_peer * peer)
|
removePeer (tr_swarm * s, tr_peer * peer)
|
||||||
{
|
{
|
||||||
tr_peer * removed;
|
|
||||||
struct peer_atom * atom = peer->atom;
|
struct peer_atom * atom = peer->atom;
|
||||||
|
|
||||||
assert (swarmIsLocked (s));
|
assert (swarmIsLocked (s));
|
||||||
|
@ -3315,18 +3308,17 @@ removePeer (tr_swarm * s, tr_peer * peer)
|
||||||
|
|
||||||
atom->time = tr_time ();
|
atom->time = tr_time ();
|
||||||
|
|
||||||
removed = tr_ptrArrayRemoveSorted (&s->peers, peer, peerCompare);
|
tr_ptrArrayRemoveSortedPointer (&s->peers, peer, peerCompare);
|
||||||
--s->stats.peerCount;
|
--s->stats.peerCount;
|
||||||
--s->stats.peerFromCount[atom->fromFirst];
|
--s->stats.peerFromCount[atom->fromFirst];
|
||||||
|
|
||||||
if (replicationExists (s))
|
if (replicationExists (s))
|
||||||
tr_decrReplicationFromBitfield (s, &peer->have);
|
tr_decrReplicationFromBitfield (s, &peer->have);
|
||||||
|
|
||||||
assert (removed == peer);
|
|
||||||
assert (s->stats.peerCount == tr_ptrArraySize (&s->peers));
|
assert (s->stats.peerCount == tr_ptrArraySize (&s->peers));
|
||||||
assert (s->stats.peerFromCount[atom->fromFirst] >= 0);
|
assert (s->stats.peerFromCount[atom->fromFirst] >= 0);
|
||||||
|
|
||||||
tr_peerFree (removed);
|
tr_peerFree (peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -215,8 +215,8 @@ tr_ptrArrayFindSorted (tr_ptrArray * t,
|
||||||
return match ? t->items[pos] : NULL;
|
return match ? t->items[pos] : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void*
|
static void*
|
||||||
tr_ptrArrayRemoveSorted (tr_ptrArray * t,
|
tr_ptrArrayRemoveSortedValue (tr_ptrArray * t,
|
||||||
const void * ptr,
|
const void * ptr,
|
||||||
int compare (const void*, const void*))
|
int compare (const void*, const void*))
|
||||||
{
|
{
|
||||||
|
@ -238,3 +238,18 @@ tr_ptrArrayRemoveSorted (tr_ptrArray * t,
|
||||||
assert ((ret == NULL) || (compare (ret, ptr) == 0));
|
assert ((ret == NULL) || (compare (ret, ptr) == 0));
|
||||||
return ret;
|
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,
|
void * value,
|
||||||
int compare (const void*, const void*));
|
int compare (const void*, const void*));
|
||||||
|
|
||||||
/** @brief Remove a pointer from an array sorted by the specified sort function
|
/** @brief Remove this specific pointer from a sorted ptrarray */
|
||||||
@return the matching pointer, or NULL if no match was found */
|
void tr_ptrArrayRemoveSortedPointer (tr_ptrArray * t,
|
||||||
void* tr_ptrArrayRemoveSorted (tr_ptrArray * array,
|
const void * ptr,
|
||||||
const void * value,
|
|
||||||
int compare (const void*, const void*));
|
int compare (const void*, const void*));
|
||||||
|
|
||||||
|
|
||||||
/** @brief Find a pointer from an array sorted by the specified sort function
|
/** @brief Find a pointer from an array sorted by the specified sort function
|
||||||
@return the matching pointer, or NULL if no match was found */
|
@return the matching pointer, or NULL if no match was found */
|
||||||
void* tr_ptrArrayFindSorted (tr_ptrArray * array,
|
void* tr_ptrArrayFindSorted (tr_ptrArray * array,
|
||||||
|
|
Loading…
Reference in a new issue