diff options
Diffstat (limited to 'hardinfo2')
| -rw-r--r-- | hardinfo2/stack.c | 78 | ||||
| -rw-r--r-- | hardinfo2/stack.h | 27 | 
2 files changed, 0 insertions, 105 deletions
| diff --git a/hardinfo2/stack.c b/hardinfo2/stack.c deleted file mode 100644 index 02a7bea6..00000000 --- a/hardinfo2/stack.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - *    HardInfo - Displays System Information - *    Copyright (C) 2003-2007 Leandro A. F. Pereira <leandro@hardinfo.org> - * - *    This program is free software; you can redistribute it and/or modify - *    it under the terms of the GNU General Public License as published by - *    the Free Software Foundation, version 2. - * - *    This program is distributed in the hope that it will be useful, - *    but WITHOUT ANY WARRANTY; without even the implied warranty of - *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - *    GNU General Public License for more details. - * - *    You should have received a copy of the GNU General Public License - *    along with this program; if not, write to the Free Software - *    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA - */ - -#include "stack.h" - -Stack* -stack_new(void) -{ -	Stack *stack; -	 -	stack = g_new0(Stack, 1); -	stack->_stack = NULL; -	 -	return stack; -} - -void -stack_free(Stack *stack) -{ -	g_return_if_fail(stack); -	 -	g_slist_free(stack->_stack); -	g_free(stack); -} - -gboolean -stack_is_empty(Stack *stack) -{ -	g_return_val_if_fail(stack, TRUE); -	 -	return stack->_stack == NULL; -} - -void -stack_push(Stack *stack, gpointer data) -{ -	g_return_if_fail(stack); -	 -	stack->_stack = g_slist_prepend(stack->_stack, data); -} - -gpointer -stack_pop(Stack *stack) -{ -	GSList *element; -	gpointer data = NULL; -	 -	if (G_LIKELY(stack && stack->_stack)) { -		element = stack->_stack; -		stack->_stack = element->next; - -		data = element->data; -		g_slist_free_1(element); -	} -	 -	return data; -} - -gpointer -stack_peek(Stack *stack) -{ -	return (G_LIKELY(stack && stack->_stack)) ? stack->_stack->data : NULL; -} diff --git a/hardinfo2/stack.h b/hardinfo2/stack.h deleted file mode 100644 index e706de2e..00000000 --- a/hardinfo2/stack.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Simple Pascal Compiler - * Stack - * - * Copyright (c) 2007-2008 Leandro A. F. Pereira <leandro@hardinfo.org> - */ -#ifndef __STACK_H__ -#define __STACK_H__ - -#include <glib.h> - -typedef struct _Stack	Stack; - -struct _Stack { -	GSList *_stack; -}; - - -Stack		*stack_new(void); -void		 stack_free(Stack *stack); - -gboolean	 stack_is_empty(Stack *stack); -void		 stack_push(Stack *stack, gpointer data); -gpointer	 stack_pop(Stack *stack); -gpointer	 stack_peek(Stack *stack); - -#endif	/* __STACK_H__ */ | 
