File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -214,6 +214,34 @@ static inline struct uchain *ulist_at(struct uchain *ulist, unsigned index)
214214 return NULL ;
215215}
216216
217+ /** @This return the next element in the list or NULL.
218+ *
219+ * @param ulist pointer to a ulist
220+ * @param element pointer to element
221+ * @return point to the next element or NULL
222+ */
223+ static inline struct uchain * ulist_next (struct uchain * ulist ,
224+ struct uchain * element )
225+ {
226+ if (!element )
227+ return ulist_peek (ulist );
228+ return element -> next != ulist ? element -> next : NULL ;
229+ }
230+
231+ /** @This return the previous element in the list or NULL.
232+ *
233+ * @param ulist pointer to a ulist
234+ * @param element pointer to element
235+ * @return point to the previous element or NULL
236+ */
237+ static inline struct uchain * ulist_prev (struct uchain * ulist ,
238+ struct uchain * element )
239+ {
240+ if (!element )
241+ return ulist_peek_last (ulist );
242+ return element -> prev != ulist ? element -> prev : NULL ;
243+ }
244+
217245/** @This sorts through a list using a comparison function.
218246 *
219247 * @param ulist pointer to a ulist
You can’t perform that action at this time.
0 commit comments