Implementation of the supporting functions for the StackEntry structure that represents a simple stack. More...
Go to the source code of this file.
Functions | |
static StackEntry * | StackEntry_Create (void *item) |
Create a new StackEntry object with the given item. | |
static void | StackEntry_Destroy (StackEntry *entry) |
Destroys the specified StackEntry object. After this function returns, the object is no longer valid. | |
void | Stack_Push (StackEntry **stack, void *item) |
Push the given entry onto the given stack. | |
void * | Stack_Pop (StackEntry **stack) |
Pop the last entry from the given stack, returning the item. | |
bool | Stack_IsEmpty (StackEntry **stack) |
Determines if the given stack is empty. | |
Implementation of the supporting functions for the StackEntry structure that represents a simple stack.
Definition in file stack.c.
bool Stack_IsEmpty | ( | StackEntry ** | stack | ) |
Determines if the given stack is empty.
stack | A pointer to a pointer to a StackEntry object representing the top of the stack. Points to a NULL if the stack is empty. This pointer to a pointer cannot be NULL. |
Definition at line 82 of file stack.c.
Referenced by Command_Undo().
void * Stack_Pop | ( | StackEntry ** | stack | ) |
Pop the last entry from the given stack, returning the item.
stack | A pointer to a pointer to a StackEntry object representing the top of the stack. Points to a NULL if the stack is empty. This pointer to a pointer cannot be NULL. |
Definition at line 63 of file stack.c.
References StackEntry::item, StackEntry::next, and StackEntry_Destroy().
Referenced by Command_Undo(), and Memento_Undo().
void Stack_Push | ( | StackEntry ** | stack, |
void * | item | ||
) |
Push the given entry onto the given stack.
stack | A pointer to a pointer to a StackEntry object representing the top of the stack. Points to a NULL if the stack is empty. This pointer to a pointer cannot be NULL. |
item | The item to store on the stack. |
Definition at line 40 of file stack.c.
References StackEntry::next, and StackEntry_Create().
Referenced by Command_Save_And_Execute(), Command_Undo(), and Memento_SaveForUndo().
|
static |
Create a new StackEntry object with the given item.
item | The item to add to the stack. |
Definition at line 16 of file stack.c.
References StackEntry::item.
Referenced by Stack_Push().
|
static |
Destroys the specified StackEntry object. After this function returns, the object is no longer valid.
entry | The StackEntry object to destroy. |
Definition at line 32 of file stack.c.
Referenced by Stack_Pop().