Changeset c0a91d1 in mainline


Ignore:
Timestamp:
2005-09-20T21:07:58Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e456008
Parents:
4fade3e
Message:

Replace #define's in list.h with type-safe inlines.

Update mips32 documentation.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/arch/mips32

    r4fade3e rc0a91d1  
    1919
    2020EMULATORS AND VIRTUALIZERS
     21        o msim 1.2.7
    2122        o msim 1.2.6 with lwl/lwr/swl/swr patch
    2223        o gxemul - both big and little endian
  • include/list.h

    r4fade3e rc0a91d1  
    3838};
    3939
    40 
    41 #define link_initialize(link) { \
    42         (link)->prev = NULL; \
    43         (link)->next = NULL; \
     40static inline void link_initialize(link_t *link)
     41{
     42        link->prev = NULL;
     43        link->next = NULL;
    4444}
    4545
    46 #define list_initialize(head) { \
    47         (head)->prev = (head); \
    48         (head)->next = (head); \
     46static inline void list_initialize(link_t *head)
     47{
     48        head->prev = head;
     49        head->next = head;
    4950}
    5051
    51 #define list_prepend(link, head) { \
    52         (link)->next = (head)->next; \
    53         (link)->prev = (head); \
    54         (head)->next->prev = (link); \
    55         (head)->next = (link); \
     52static inline void list_prepend(link_t *link, link_t *head)
     53{
     54        link->next = head->next;
     55        link->prev = head;
     56        head->next->prev = link;
     57        head->next = link;
    5658}
    5759
    58 #define list_append(link, head) { \
    59         (link)->prev = (head)->prev; \
    60         (link)->next = (head); \
    61         (head)->prev->next = (link); \
    62         (head)->prev = (link); \
     60static inline void list_append(link_t *link, link_t *head)
     61{
     62        link->prev = head->prev;
     63        link->next = head;
     64        head->prev->next = link;
     65        head->prev = link;
    6366}
    6467
    65 #define list_remove(link) { \
    66         (link)->next->prev = (link)->prev; \
    67         (link)->prev->next = (link)->next; \
    68         link_initialize(link); \
     68static inline void list_remove(link_t *link)
     69{
     70        link->next->prev = link->prev;
     71        link->prev->next = link->next;
     72        link_initialize(link);
    6973}
    7074
    71 #define list_empty(head) (((head)->next == (head))?true:false)
     75static inline bool list_empty(link_t *head) { return head->next == head ? true : false; }
    7276
    7377#define list_get_instance(link,type,member) (type *)(((__u8*)(link))-((__u8*)&(((type *)NULL)->member)))
Note: See TracChangeset for help on using the changeset viewer.