Blame stack.h

Packit 400c17
/*
Packit 400c17
	Copyright(C) 2016, Red Hat, Inc., Stanislav Kozina
Packit 400c17
Packit 400c17
	This program is free software: you can redistribute it and/or modify
Packit 400c17
	it under the terms of the GNU General Public License as published by
Packit 400c17
	the Free Software Foundation, either version 3 of the License, or
Packit 400c17
	(at your option) any later version.
Packit 400c17
Packit 400c17
	This program is distributed in the hope that it will be useful,
Packit 400c17
	but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 400c17
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 400c17
	GNU General Public License for more details.
Packit 400c17
Packit 400c17
	You should have received a copy of the GNU General Public License
Packit 400c17
	along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 400c17
*/
Packit 400c17
Packit 400c17
#ifndef STACK_H_
Packit 400c17
#define	STACK_H_
Packit 400c17
Packit 400c17
typedef struct {
Packit 400c17
	unsigned int st_capacity; /* Total size of the stack */
Packit 400c17
	unsigned int st_count; /* Number of items stored */
Packit 400c17
	void **st_data; /* Stack itself */
Packit 400c17
} stack_t;
Packit 400c17
Packit 400c17
extern stack_t *stack_init(void);
Packit 400c17
extern void stack_destroy(stack_t *);
Packit 400c17
extern void stack_push(stack_t *, void *);
Packit 400c17
extern void *stack_pop(stack_t *);
Packit 400c17
extern void *stack_head(stack_t *);
Packit 400c17
extern void walk_stack(stack_t *, void (*)(void *, void *), void *);
Packit 400c17
extern void walk_stack_backward(stack_t *, void (*cb)(void *, void *), void *);
Packit 400c17
Packit 400c17
#endif /* STACK_H_ */