Sfoglia il codice sorgente

Add faux_sched_init_ev_iter()

Serj Kalichev 1 anno fa
parent
commit
e5c36764f3
3 ha cambiato i file con 17 aggiunte e 0 eliminazioni
  1. 1 0
      faux/faux.map
  2. 1 0
      faux/sched.h
  3. 15 0
      faux/sched/sched.c

+ 1 - 0
faux/faux.map

@@ -284,6 +284,7 @@ FAUX_2.0 {
 		faux_sched_del;
 		faux_sched_del_by_id;
 		faux_sched_del_by_data;
+		faux_sched_init_ev_iter;
 		faux_sched_get_by_id;
 		faux_sched_get_by_data;
 

+ 1 - 0
faux/sched.h

@@ -58,6 +58,7 @@ faux_ev_t *faux_sched_pop(faux_sched_t *sched);
 ssize_t faux_sched_del(faux_sched_t *sched, faux_ev_t *ev);
 ssize_t faux_sched_del_by_id(faux_sched_t *sched, int id);
 ssize_t faux_sched_del_by_data(faux_sched_t *sched, void *data);
+faux_list_node_t *faux_sched_init_ev_iter(faux_sched_t *sched);
 faux_ev_t *faux_sched_get_by_id(faux_sched_t *sched, int ev_id,
 	faux_list_node_t **saved);
 faux_ev_t *faux_sched_get_by_data(faux_sched_t *sched, void *data,

+ 15 - 0
faux/sched/sched.c

@@ -368,6 +368,21 @@ ssize_t faux_sched_del_by_data(faux_sched_t *sched, void *data)
 }
 
 
+/** @brief Init scheduled event iterator.
+ *
+ * @param [in] sched Allocated and initialized sched object.
+ * @return Event iterator or NULL on error or empty scheduled event list.
+ */
+faux_list_node_t *faux_sched_init_ev_iter(faux_sched_t *sched)
+{
+	assert(sched);
+	if (!sched)
+		return NULL;
+
+	return faux_list_head(sched->list);
+}
+
+
 /** @brief Get scheduled event by specified value.
  *
  * Static function.