Libparserutils
stack.h
Go to the documentation of this file.
1/*
2 * This file is part of LibParserUtils.
3 * Licensed under the MIT License,
4 * http://www.opensource.org/licenses/mit-license.php
5 * Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org>
6 */
7
8#ifndef parserutils_utils_stack_h_
9#define parserutils_utils_stack_h_
10
11#ifdef __cplusplus
12extern "C"
13{
14#endif
15
16#include <stddef.h>
17
18#include <parserutils/errors.h>
20
23
25 parserutils_stack **stack);
27
29 const void *item);
31
33
34#ifdef __cplusplus
35}
36#endif
37
38#endif
39
parserutils_error
Definition: errors.h:18
parserutils_error parserutils_stack_create(size_t item_size, size_t chunk_size, parserutils_stack **stack)
Create a stack.
Definition: stack.c:35
void * parserutils_stack_get_current(parserutils_stack *stack)
Retrieve a pointer to the current item on the stack.
Definition: stack.c:151
parserutils_error parserutils_stack_pop(parserutils_stack *stack, void *item)
Pop an item off a stack.
Definition: stack.c:126
parserutils_error parserutils_stack_push(parserutils_stack *stack, const void *item)
Push an item onto the stack.
Definition: stack.c:87
parserutils_error parserutils_stack_destroy(parserutils_stack *stack)
Destroy a stack instance.
Definition: stack.c:69
Stack object.
Definition: stack.c:17
size_t item_size
Size of an item in the stack.
Definition: stack.c:18
size_t chunk_size
Size of a stack chunk.
Definition: stack.c:19