Changeset 9f272d9 in mainline for uspace/lib/c/generic/async/client.c


Ignore:
Timestamp:
2018-06-19T19:43:42Z (6 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5c76cc61
Parents:
47be512
git-author:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-05-31 16:26:54)
git-committer:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-19 19:43:42)
Message:

Statically allocate session_ns.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/async/client.c

    r47be512 r9f272d9  
    9999#include <async.h>
    100100#include "../private/async.h"
     101#include "../private/ns.h"
    101102#undef LIBC_ASYNC_C_
    102103
     
    122123
    123124/** Naming service session */
    124 async_sess_t *session_ns;
     125async_sess_t session_ns;
    125126
    126127/** Message data */
     
    210211void __async_client_init(void)
    211212{
    212         session_ns = (async_sess_t *) malloc(sizeof(async_sess_t));
    213         if (session_ns == NULL)
    214                 abort();
    215 
    216         session_ns->iface = 0;
    217         session_ns->mgmt = EXCHANGE_ATOMIC;
    218         session_ns->phone = PHONE_NS;
    219         session_ns->arg1 = 0;
    220         session_ns->arg2 = 0;
    221         session_ns->arg3 = 0;
    222 
    223         fibril_mutex_initialize(&session_ns->remote_state_mtx);
    224         session_ns->remote_state_data = NULL;
    225 
    226         list_initialize(&session_ns->exch_list);
    227         fibril_mutex_initialize(&session_ns->mutex);
    228         atomic_set(&session_ns->refcnt, 0);
     213        session_ns.iface = 0;
     214        session_ns.mgmt = EXCHANGE_ATOMIC;
     215        session_ns.phone = PHONE_NS;
     216        session_ns.arg1 = 0;
     217        session_ns.arg2 = 0;
     218        session_ns.arg3 = 0;
     219
     220        fibril_mutex_initialize(&session_ns.remote_state_mtx);
     221        session_ns.remote_state_data = NULL;
     222
     223        list_initialize(&session_ns.exch_list);
     224        fibril_mutex_initialize(&session_ns.mutex);
     225        atomic_set(&session_ns.refcnt, 0);
    229226}
    230227
Note: See TracChangeset for help on using the changeset viewer.