From ba46a8b5c5717cdff25b39a2cd03a461998921c5 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Mon, 9 Jan 2017 15:37:49 +0100 Subject: lib: Revise implementation of list Adds LGPL license to the ouroboros lists. --- src/ipcpd/ipcp-data.c | 8 ++++---- src/ipcpd/normal/ribmgr.c | 14 +++++++------- src/ipcpd/timerwheel.c | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/ipcpd') diff --git a/src/ipcpd/ipcp-data.c b/src/ipcpd/ipcp-data.c index 132684c2..2d1d2752 100644 --- a/src/ipcpd/ipcp-data.c +++ b/src/ipcpd/ipcp-data.c @@ -119,9 +119,9 @@ struct ipcp_data * ipcp_data_init(struct ipcp_data * dst, dst->dif_name = NULL; /* init the lists */ - INIT_LIST_HEAD(&dst->registry); - INIT_LIST_HEAD(&dst->directory); - INIT_LIST_HEAD(&dst->dir_queries); + list_head_init(&dst->registry); + list_head_init(&dst->directory); + list_head_init(&dst->dir_queries); /* init the locks */ pthread_rwlock_init(&dst->reg_lock, NULL); @@ -437,7 +437,7 @@ struct dir_query * ipcp_data_dir_query_create(char * name) pthread_cond_init(&query->cond, &cattr); pthread_mutex_init(&query->lock, NULL); - INIT_LIST_HEAD(&query->next); + list_head_init(&query->next); return query; } diff --git a/src/ipcpd/normal/ribmgr.c b/src/ipcpd/normal/ribmgr.c index e52db08a..6356d48c 100644 --- a/src/ipcpd/normal/ribmgr.c +++ b/src/ipcpd/normal/ribmgr.c @@ -471,9 +471,9 @@ static int write_ro_msg(struct cdap * neighbor, int ribmgr_init() { - INIT_LIST_HEAD(&rib.flows); - INIT_LIST_HEAD(&rib.subs); - INIT_LIST_HEAD(&rib.ro_ids); + list_head_init(&rib.flows); + list_head_init(&rib.subs); + list_head_init(&rib.ro_ids); rib.root = malloc(sizeof(*(rib.root))); if (rib.root == NULL) @@ -993,7 +993,7 @@ static int ro_id_create(char * name, ro_msg_t * msg) tmp->seqno = msg->seqno; tmp->full_name = strdup(name); - INIT_LIST_HEAD(&tmp->next); + list_head_init(&tmp->next); if (tmp->full_name == NULL) { free(tmp); @@ -1154,7 +1154,7 @@ static int ribmgr_add_flow(int fd) return -1; } - INIT_LIST_HEAD(&flow->next); + list_head_init(&flow->next); flow->instance = instance; flow->fd = fd; @@ -1310,7 +1310,7 @@ int ribmgr_enrol() pthread_rwlock_wrlock(&rib.flows_lock); - assert(!list_empty(&rib.flows)); + assert(!list_is_empty(&rib.flows)); flow = list_first_entry((&rib.flows), struct mgmt_flow, next); instance = flow->instance; @@ -1631,7 +1631,7 @@ int ro_subscribe(const char * name, struct ro_sub_ops * ops) if (sub == NULL) return -ENOMEM; - INIT_LIST_HEAD(&sub->next); + list_head_init(&sub->next); sub->name = strdup(name); if (sub->name == NULL) { diff --git a/src/ipcpd/timerwheel.c b/src/ipcpd/timerwheel.c index 4ef7ce2f..1d842c8f 100644 --- a/src/ipcpd/timerwheel.c +++ b/src/ipcpd/timerwheel.c @@ -232,7 +232,7 @@ struct timerwheel * timerwheel_create(unsigned int resolution, tw->intv.tv_sec = (tw->resolution / FRAC) / 1000; tw->intv.tv_nsec = ((tw->resolution / FRAC) % 1000) * MILLION; - INIT_LIST_HEAD(&tw->wq); + list_head_init(&tw->wq); if (pthread_mutex_init(&tw->lock, NULL)) { LOG_DBG("Could not init mutex."); @@ -265,7 +265,7 @@ struct timerwheel * timerwheel_create(unsigned int resolution, now.tv_nsec -= (now.tv_nsec % MILLION); for (i = 0; i < tw->elements; ++i) { - INIT_LIST_HEAD(&tw->wheel[i].funcs); + list_head_init(&tw->wheel[i].funcs); tw->wheel[i].expiry = now; ts_add(&now, &res_ts, &now); } -- cgit v1.2.3