Changeset f959a20f in mainline for uspace/lib/nic/src/nic_driver.c


Ignore:
Timestamp:
2019-02-01T22:32:38Z (5 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
00b7fc8
Parents:
1a37496
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-01 21:22:39)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-01 22:32:38)
Message:

Avoid directly using .head/.next/.prev of list_t/link_t

Use existing constructs from <adt/list.h> instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/nic/src/nic_driver.c

    r1a37496 rf959a20f  
    329329
    330330        if (nic_globals.frame_list_cache_size > 0) {
    331                 frames =
    332                     list_get_instance(list_first(&nic_globals.frame_list_cache),
    333                     nic_frame_list_t, head);
    334                 list_remove(&frames->head);
    335                 list_initialize(frames);
     331                frames = list_pop(&nic_globals.frame_list_cache,
     332                    nic_frame_list_t, link);
     333                assert(frames);
     334                list_initialize(&frames->list);
    336335                nic_globals.frame_list_cache_size--;
    337336                fibril_mutex_unlock(&nic_globals.lock);
     
    341340                frames = malloc(sizeof (nic_frame_list_t));
    342341                if (frames != NULL)
    343                         list_initialize(frames);
     342                        list_initialize(&frames->list);
    344343        }
    345344
     
    356355                free(frames);
    357356        } else {
    358                 list_prepend(&frames->head, &nic_globals.frame_list_cache);
     357                list_prepend(&frames->link, &nic_globals.frame_list_cache);
    359358                nic_globals.frame_list_cache_size++;
    360359                fibril_mutex_unlock(&nic_globals.lock);
     
    372371{
    373372        assert(frame != NULL && frames != NULL);
    374         list_append(&frame->link, frames);
     373        list_append(&frame->link, &frames->list);
    375374}
    376375
     
    576575        if (frames == NULL)
    577576                return;
    578         while (!list_empty(frames)) {
    579                 nic_frame_t *frame =
    580                     list_get_instance(list_first(frames), nic_frame_t, link);
    581 
    582                 list_remove(&frame->link);
     577        while (!list_empty(&frames->list)) {
     578                nic_frame_t *frame = list_pop(&frames->list, nic_frame_t, link);
    583579                nic_received_frame(nic_data, frame);
    584580        }
Note: See TracChangeset for help on using the changeset viewer.