Changeset b72efe8 in mainline for uspace/app


Ignore:
Timestamp:
2011-06-19T14:38:59Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
74464e8
Parents:
1d1bb0f
Message:

Separate list_t typedef from link_t (user-space part).

  • list_t represents lists
  • Use list_first(), list_last(), list_empty() where appropriate
  • Use list_foreach() where possible
  • assert_link_not_used()
  • usb_hid_report_path_free() shall not unlink the path, caller must do it
Location:
uspace/app
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/edit/sheet.c

    r1d1bb0f rb72efe8  
    7575                return ENOMEM;
    7676
    77         list_initialize(&sh->tags_head);
     77        list_initialize(&sh->tags);
    7878
    7979        return EOK;
     
    9797        char *ipp;
    9898        size_t sz;
    99         link_t *link;
    10099        tag_t *tag;
    101100        char *newp;
     
    121120        /* Adjust tags. */
    122121
    123         link = sh->tags_head.next;
    124         while (link != &sh->tags_head) {
     122        list_foreach(sh->tags, link) {
    125123                tag = list_get_instance(link, tag_t, link);
    126124
     
    129127                else if (tag->b_off == pos->b_off && dir == dir_before)
    130128                        tag->b_off += sz;
    131 
    132                 link = link->next;
    133129        }
    134130
     
    150146        char *spp;
    151147        size_t sz;
    152         link_t *link;
    153148        tag_t *tag;
    154149        char *newp;
     
    162157
    163158        /* Adjust tags. */
    164         link = sh->tags_head.next;
    165         while (link != &sh->tags_head) {
     159        list_foreach(sh->tags, link) {
    166160                tag = list_get_instance(link, tag_t, link);
    167161
     
    170164                else if (tag->b_off >= spos->b_off)
    171165                        tag->b_off = spos->b_off;
    172 
    173                 link = link->next;
    174166        }
    175167
     
    328320        tag->b_off = pt->b_off;
    329321        tag->sh = sh;
    330         list_append(&tag->link, &sh->tags_head);
     322        list_append(&tag->link, &sh->tags);
    331323}
    332324
  • uspace/app/edit/sheet.h

    r1d1bb0f rb72efe8  
    5757        char *data;
    5858
    59         link_t tags_head;
     59        list_t tags;
    6060} sheet_t;
    6161
     
    9191        /* Note: This structure is opaque for the user. */
    9292
    93         /** Link to list of all tags in the sheet (see sheet_t.tags_head) */
     93        /** Link to list of all tags in the sheet (see sheet_t.tags) */
    9494        link_t link;
    9595        sheet_t *sh;
  • uspace/app/sbi/src/compat.h

    r1d1bb0f rb72efe8  
    3838#ifdef __HELENOS__
    3939
     40#define list sbi_list
     41#define list_t sbi_list_t
     42
    4043/*
    4144 * Avoid name conflicts with ADT library.
     
    4447#define list_prepend sbi_list_prepend
    4548#define list_remove sbi_list_remove
     49#define list_first sbi_list_first
     50#define list_last sbi_list_last
    4651
    4752#endif
  • uspace/app/sbi/src/list_t.h

    r1d1bb0f rb72efe8  
    3030#define LIST_T_H_
    3131
     32#include "compat.h"
     33
    3234typedef struct list_node {
    3335        struct list_node *prev, *next;
  • uspace/app/tester/mm/common.c

    r1d1bb0f rb72efe8  
    7373        link_t *link;
    7474       
    75         while ((link = list_head(&mem_blocks)) != NULL) {
     75        while ((link = list_first(&mem_blocks)) != NULL) {
    7676                mem_block_t *block = list_get_instance(link, mem_block_t, link);
    7777                free_block(block);
    7878        }
    7979       
    80         while ((link = list_head(&mem_areas)) != NULL) {
     80        while ((link = list_first(&mem_areas)) != NULL) {
    8181                mem_area_t *area = list_get_instance(link, mem_area_t, link);
    8282                unmap_area(area);
  • uspace/app/usbinfo/dump.c

    r1d1bb0f rb72efe8  
    103103void dump_match_ids(match_id_list_t *matches, const char *line_prefix)
    104104{
    105         link_t *link;
    106         for (link = matches->ids.next;
    107             link != &matches->ids;
    108             link = link->next) {
     105        list_foreach(matches->ids, link) {
    109106                match_id_t *match = list_get_instance(link, match_id_t, link);
    110107
  • uspace/app/usbinfo/hid.c

    r1d1bb0f rb72efe8  
    101101            get_indent(0), iface_no);
    102102        list_foreach(report->reports, report_it) {
    103                 usb_hid_report_description_t *description = list_get_instance(report_it, usb_hid_report_description_t, link);
     103                usb_hid_report_description_t *description = list_get_instance(
     104                    report_it, usb_hid_report_description_t, reports_link);
    104105                printf("%sReport %d (type %d)\n", get_indent(1),
    105106                    (int) description->report_id,
    106107                    (int) description->type);
    107108                list_foreach(description->report_items, item_it) {
    108                         usb_hid_report_field_t *field = list_get_instance(item_it, usb_hid_report_field_t, link);
     109                        usb_hid_report_field_t *field = list_get_instance(
     110                            item_it, usb_hid_report_field_t, ritems_link);
    109111                        printf("%sUsage page = 0x%04x    Usage = 0x%04x\n",
    110112                            get_indent(2),
Note: See TracChangeset for help on using the changeset viewer.