From 03fab2c20d92360f2a2b4362c7fa9dd38c920b13 Mon Sep 17 00:00:00 2001 From: "Leandro A. F. Pereira" Date: Sat, 21 Feb 2009 12:29:39 -0300 Subject: Remove unneeded stack routines --- hardinfo2/stack.c | 78 ------------------------------------------------------- hardinfo2/stack.h | 27 ------------------- 2 files changed, 105 deletions(-) delete mode 100644 hardinfo2/stack.c delete mode 100644 hardinfo2/stack.h (limited to 'hardinfo2') 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 - * - * 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 - */ -#ifndef __STACK_H__ -#define __STACK_H__ - -#include - -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__ */ -- cgit v1.2.3