Skip to content

Commit

Permalink
fix ungrouped sll macro
Browse files Browse the repository at this point in the history
  • Loading branch information
agl-alexglopez committed Dec 16, 2024
1 parent c669d9a commit 0afc457
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions ccc/singly_linked_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,6 @@ destruction.

/**@}*/

/** @brief Write a compound literal directly to allocated memory at the front.
O(1).
@param [in] list_ptr a pointer to the singly linked list.
@param [in] struct_initializer a compound literal containing the elements to
be written to a newly allocated node.
@return a reference to the element pushed to the front or NULL if allocation
failed.
Note that it only makes sense to use this method when the container is given
allocation permission. Otherwise NULL is returned due to an inability for the
container to allocate memory. */
#define ccc_sll_emplace_front(list_ptr, struct_initializer...) \
ccc_impl_sll_emplace_front(list_ptr, struct_initializer)

/** @name Insert and Remove Interface
Add or remove elements from the container. */
/**@{*/
Expand All @@ -108,6 +94,20 @@ If allocation is allowed the provided element is copied to a new allocation. */
[[nodiscard]] void *ccc_sll_push_front(ccc_singly_linked_list *sll,
ccc_sll_elem *elem);

/** @brief Write a compound literal directly to allocated memory at the front.
O(1).
@param [in] list_ptr a pointer to the singly linked list.
@param [in] struct_initializer a compound literal containing the elements to
be written to a newly allocated node.
@return a reference to the element pushed to the front or NULL if allocation
failed.
Note that it only makes sense to use this method when the container is given
allocation permission. Otherwise NULL is returned due to an inability for the
container to allocate memory. */
#define ccc_sll_emplace_front(list_ptr, struct_initializer...) \
ccc_impl_sll_emplace_front(list_ptr, struct_initializer)

/** @brief Pop the front element from the list. O(1).
@param [in] sll a pointer to the singly linked list.
@return ok if the list is non-empty and the pop is successful. An input error
Expand Down

0 comments on commit 0afc457

Please sign in to comment.