Changeset f959a20f in mainline for uspace/srv/fs/fat/fat_idx.c


Ignore:
Timestamp:
2019-02-01T22:32:38Z (6 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/srv/fs/fat/fat_idx.c

    r1a37496 rf959a20f  
    284284                link_t *lnk;
    285285                freed_t *n;
    286                 for (lnk = u->freed_list.head.next; lnk != &u->freed_list.head;
    287                     lnk = lnk->next) {
     286                for (lnk = list_first(&u->freed_list); lnk != NULL;
     287                    lnk = list_next(lnk, &u->freed_list)) {
    288288                        freed_t *f = list_get_instance(lnk, freed_t, link);
    289289                        if (f->first == index + 1) {
    290290                                f->first--;
    291                                 if (lnk->prev != &u->freed_list.head)
    292                                         try_coalesce_intervals(lnk->prev, lnk,
    293                                             lnk);
     291                                link_t *prev = list_prev(lnk, &u->freed_list);
     292                                if (prev)
     293                                        try_coalesce_intervals(prev, lnk, lnk);
    294294                                fibril_mutex_unlock(&unused_lock);
    295295                                return;
     
    297297                        if (f->last == index - 1) {
    298298                                f->last++;
    299                                 if (lnk->next != &u->freed_list.head)
    300                                         try_coalesce_intervals(lnk, lnk->next,
    301                                             lnk);
     299                                link_t *next = list_next(lnk, &u->freed_list);
     300                                if (next)
     301                                        try_coalesce_intervals(lnk, next, lnk);
    302302                                fibril_mutex_unlock(&unused_lock);
    303303                                return;
Note: See TracChangeset for help on using the changeset viewer.