Changeset feeac0d in mainline for uspace/srv/locsrv


Ignore:
Timestamp:
2013-09-10T16:32:35Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4982d87
Parents:
e8d6ce2
Message:

Simplify use of list_foreach.

Location:
uspace/srv/locsrv
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/locsrv/category.c

    re8d6ce2 rfeeac0d  
    7373
    7474        size_t pos = 0;
    75         list_foreach(cdir->categories, item) {
    76                 category_t *cat =
    77                     list_get_instance(item, category_t, cat_list);
    78 
     75        list_foreach(cdir->categories, cat_list, category_t, cat) {
    7976                if (pos < buf_cnt)
    8077                        id_buf[pos] = cat->id;
     
    116113
    117114        /* Verify that category does not contain this service yet. */
    118         list_foreach(cat->svc_memb, item) {
    119                 svc_categ_t *memb = list_get_instance(item, svc_categ_t,
    120                     cat_link);
     115        list_foreach(cat->svc_memb, cat_link, svc_categ_t, memb) {
    121116                if (memb->svc == svc) {
    122117                        return EEXIST;
     
    154149        assert(fibril_mutex_is_locked(&cdir->mutex));
    155150
    156         list_foreach(cdir->categories, item) {
    157                 category_t *cat = list_get_instance(item, category_t,
    158                     cat_list);
     151        list_foreach(cdir->categories, cat_list, category_t, cat) {
    159152                if (cat->id == catid)
    160153                        return cat;
     
    169162        assert(fibril_mutex_is_locked(&cdir->mutex));
    170163
    171         list_foreach(cdir->categories, item) {
    172                 category_t *cat = list_get_instance(item, category_t,
    173                     cat_list);
     164        list_foreach(cdir->categories, cat_list, category_t, cat) {
    174165                if (str_cmp(cat->name, name) == 0)
    175166                        return cat;
     
    197188
    198189        size_t pos = 0;
    199         list_foreach(cat->svc_memb, item) {
    200                 svc_categ_t *memb =
    201                     list_get_instance(item, svc_categ_t, cat_link);
    202 
     190        list_foreach(cat->svc_memb, cat_link, svc_categ_t, memb) {
    203191                if (pos < buf_cnt)
    204192                        id_buf[pos] = memb->svc->id;
  • uspace/srv/locsrv/locsrv.c

    re8d6ce2 rfeeac0d  
    184184        assert(fibril_mutex_is_locked(&services_list_mutex));
    185185       
    186         list_foreach(namespaces_list, item) {
    187                 loc_namespace_t *namespace =
    188                     list_get_instance(item, loc_namespace_t, namespaces);
     186        list_foreach(namespaces_list, namespaces, loc_namespace_t, namespace) {
    189187                if (str_cmp(namespace->name, name) == 0)
    190188                        return namespace;
     
    203201        assert(fibril_mutex_is_locked(&services_list_mutex));
    204202       
    205         list_foreach(namespaces_list, item) {
    206                 loc_namespace_t *namespace =
    207                     list_get_instance(item, loc_namespace_t, namespaces);
     203        list_foreach(namespaces_list, namespaces, loc_namespace_t, namespace) {
    208204                if (namespace->id == id)
    209205                        return namespace;
     
    219215        assert(fibril_mutex_is_locked(&services_list_mutex));
    220216       
    221         list_foreach(services_list, item) {
    222                 loc_service_t *service =
    223                     list_get_instance(item, loc_service_t, services);
     217        list_foreach(services_list, services, loc_service_t, service) {
    224218                if ((str_cmp(service->namespace->name, ns_name) == 0)
    225219                    && (str_cmp(service->name, name) == 0))
     
    239233        assert(fibril_mutex_is_locked(&services_list_mutex));
    240234       
    241         list_foreach(services_list, item) {
    242                 loc_service_t *service =
    243                     list_get_instance(item, loc_service_t, services);
     235        list_foreach(services_list, services, loc_service_t, service) {
    244236                if (service->id == id)
    245237                        return service;
     
    889881        fibril_mutex_lock(&callback_sess_mutex);
    890882       
    891         list_foreach(callback_sess_list, link) {
    892                 cb_sess_t *cb_sess;
    893                
    894                 cb_sess = list_get_instance(link, cb_sess_t, cb_sess_list);
    895                
     883        list_foreach(callback_sess_list, cb_sess_list, cb_sess_t, cb_sess) {
    896884                async_exch_t *exch = async_exchange_begin(cb_sess->sess);
    897885                async_msg_0(exch, LOC_EVENT_CAT_CHANGE);
     
    10501038       
    10511039        size_t pos = 0;
    1052         list_foreach(namespaces_list, item) {
    1053                 loc_namespace_t *namespace =
    1054                     list_get_instance(item, loc_namespace_t, namespaces);
    1055                
     1040        list_foreach(namespaces_list, namespaces, loc_namespace_t, namespace) {
    10561041                desc[pos].id = namespace->id;
    10571042                str_cpy(desc[pos].name, LOC_NAME_MAXLEN, namespace->name);
     
    11141099       
    11151100        size_t pos = 0;
    1116         list_foreach(services_list, item) {
    1117                 loc_service_t *service =
    1118                     list_get_instance(item, loc_service_t, services);
    1119                
     1101        list_foreach(services_list, services, loc_service_t, service) {
    11201102                if (service->namespace == namespace) {
    11211103                        desc[pos].id = service->id;
Note: See TracChangeset for help on using the changeset viewer.