Changeset 14167


Ignore:
Timestamp:
Aug 17, 2013, 5:20:31 PM (8 years ago)
Author:
jordan
Message:

silence a small handful of minor gcc compiler warnings in libtransmission

Location:
trunk/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/bandwidth.c

    r13935 r14167  
    142142  if (b->parent)
    143143    {
    144       void * removed;
    145 
    146144      assert (tr_isBandwidth (b->parent));
    147 
    148       removed = tr_ptrArrayRemoveSorted (&b->parent->children, b, compareBandwidth);
    149       assert (removed == b);
    150       assert (tr_ptrArrayFindSorted (&b->parent->children, b, compareBandwidth) == NULL);
    151 
     145      tr_ptrArrayRemoveSortedPointer (&b->parent->children, b, compareBandwidth);
    152146      b->parent = NULL;
    153147    }
  • trunk/libtransmission/peer-mgr.c

    r14114 r14167  
    19551955  tr_peerMgr * manager = vmanager;
    19561956  tr_swarm  * s;
    1957   tr_handshake * ours;
    19581957
    19591958  assert (io);
     
    19651964
    19661965  if (tr_peerIoIsIncoming (io))
    1967     ours = tr_ptrArrayRemoveSorted (&manager->incomingHandshakes,
     1966    tr_ptrArrayRemoveSortedPointer (&manager->incomingHandshakes,
    19681967                                    handshake, handshakeCompare);
    19691968  else if (s)
    1970     ours = tr_ptrArrayRemoveSorted (&s->outgoingHandshakes,
     1969    tr_ptrArrayRemoveSortedPointer (&s->outgoingHandshakes,
    19711970                                    handshake, handshakeCompare);
    1972   else
    1973     ours = handshake;
    1974 
    1975   assert (ours);
    1976   assert (ours == handshake);
    19771971
    19781972  if (s)
     
    33083302removePeer (tr_swarm * s, tr_peer * peer)
    33093303{
    3310   tr_peer * removed;
    33113304  struct peer_atom * atom = peer->atom;
    33123305
     
    33163309  atom->time = tr_time ();
    33173310
    3318   removed = tr_ptrArrayRemoveSorted (&s->peers, peer, peerCompare);
     3311  tr_ptrArrayRemoveSortedPointer (&s->peers, peer, peerCompare);
    33193312  --s->stats.peerCount;
    33203313  --s->stats.peerFromCount[atom->fromFirst];
     
    33233316    tr_decrReplicationFromBitfield (s, &peer->have);
    33243317
    3325   assert (removed == peer);
    33263318  assert (s->stats.peerCount == tr_ptrArraySize (&s->peers));
    33273319  assert (s->stats.peerFromCount[atom->fromFirst] >= 0);
    33283320
    3329   tr_peerFree (removed);
     3321  tr_peerFree (peer);
    33303322}
    33313323
  • trunk/libtransmission/ptrarray.c

    r13788 r14167  
    216216}
    217217
    218 void*
    219 tr_ptrArrayRemoveSorted (tr_ptrArray * t,
    220                          const void  * ptr,
    221                          int           compare (const void*, const void*))
     218static void*
     219tr_ptrArrayRemoveSortedValue (tr_ptrArray * t,
     220                              const void  * ptr,
     221                              int           compare (const void*, const void*))
    222222{
    223223  int pos;
     
    239239  return ret;
    240240}
     241
     242void
     243tr_ptrArrayRemoveSortedPointer (tr_ptrArray * t,
     244                                const void  * ptr,
     245                                int           compare (const void*, const void*))
     246{
     247#ifdef NDEBUG
     248  tr_ptrArrayRemoveSortedValue (t, ptr, compare);
     249#else
     250  void * removed = tr_ptrArrayRemoveSortedValue (t, ptr, compare);
     251  assert (removed != NULL);
     252  assert (removed == ptr);
     253  assert (tr_ptrArrayFindSorted (t, ptr, compare) == NULL);
     254#endif
     255}
  • trunk/libtransmission/ptrarray.h

    r13826 r14167  
    131131                             int compare (const void*, const void*));
    132132
    133 /** @brief Remove a pointer from an array sorted by the specified sort function
    134     @return the matching pointer, or NULL if no match was found */
    135 void* tr_ptrArrayRemoveSorted (tr_ptrArray * array,
    136                                const void  * value,
    137                                int compare (const void*, const void*));
     133/** @brief Remove this specific pointer from a sorted ptrarray */
     134void tr_ptrArrayRemoveSortedPointer (tr_ptrArray * t,
     135                                     const void  * ptr,
     136                                     int           compare (const void*, const void*));
     137
    138138
    139139/** @brief Find a pointer from an array sorted by the specified sort function
Note: See TracChangeset for help on using the changeset viewer.