Ignore:
Timestamp:
Apr 23, 2010, 11:45:44 PM (12 years ago)
Author:
charles
Message:

(trunk libT) #2842 "Transmission crashes randomly on ARM-based Synology NAS" -- experimental commit based on giovannibajo's suggestion in comment:39 about the list struct's alignment

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/list.h

    r9891 r10524  
    102102
    103103
    104 /** @brief Double-linked list with easy memory management and fast insert/remove operations */
    105 struct __tr_list
    106 {
    107     struct __tr_list * next, * prev;
    108 };
    109 
    110 /**
    111  * @brief Given a __tr_list node that's embedded in a struct, returns a pointer to the struct.
    112  * @param ptr     pointer to the embedded __tr_list
    113  * @param type    struct type that has contains the __tr_list
    114  * @param field   the name of the struct's _tr_list field
    115  */
    116 #define __tr_list_entry(ptr,type,field) ((type*) (((char*)ptr) - offsetof(type,field)))
    117 
    118 typedef int  ( *__tr_list_cmp_t ) ( const void * a, const void * b );
    119 typedef void ( *__tr_list_free_t )( void * );
    120 
    121 
    122 /** @brief Init @head as an empty list. */
    123 static inline void
    124 __tr_list_init( struct __tr_list * head )
    125 {
    126     head->next = head->prev = head;
    127 }
    128 
    129 
    130 /** @brief Insert @list between @prev and @next. */
    131 void
    132 __tr_list_insert( struct __tr_list * list,
    133                   struct __tr_list * prev,
    134                   struct __tr_list * next);
    135 
    136 /** @brief Append @list to the end of @head. */
    137 static inline void
    138 __tr_list_append( struct __tr_list * head, struct __tr_list * list)
    139 {
    140     __tr_list_insert( list, head->prev, head );
    141 }
    142 
    143 /** @brief Remove @head from the list it is in. */
    144 void __tr_list_remove( struct __tr_list * head );
    145 
    146 /** @brief Destroy the list and free all nodes */
    147 void __tr_list_destroy( struct __tr_list * head, __tr_list_free_t func );
    148 
    149104/* @} */
    150105#endif /* TR_LIST_H */
Note: See TracChangeset for help on using the changeset viewer.