2012-07-14 12:38:13 +03:00
|
|
|
/*
|
|
|
|
* WrapSix
|
|
|
|
* Copyright (C) 2008-2012 Michal Zima <xhire@mujmalysvet.cz>
|
|
|
|
*
|
|
|
|
* 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, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LINKEDLIST_H
|
|
|
|
#define LINKEDLIST_H
|
|
|
|
|
2012-07-21 22:13:15 +03:00
|
|
|
#include <time.h> /* time_t */
|
|
|
|
|
2012-07-14 12:38:13 +03:00
|
|
|
/* Linked list node structure */
|
|
|
|
typedef struct s_linkedlist_node {
|
|
|
|
struct s_linkedlist_node *prev;
|
|
|
|
struct s_linkedlist_node *next;
|
|
|
|
void *data;
|
2012-07-21 22:13:15 +03:00
|
|
|
time_t time;
|
2012-07-14 12:38:13 +03:00
|
|
|
} linkedlist_node_t;
|
|
|
|
|
|
|
|
/* Linked list root structure */
|
|
|
|
typedef struct s_linkedlist {
|
|
|
|
linkedlist_node_t first;
|
|
|
|
linkedlist_node_t last;
|
|
|
|
} linkedlist_t;
|
|
|
|
|
|
|
|
linkedlist_t *linkedlist_create(void);
|
|
|
|
void linkedlist_destroy(linkedlist_t *root);
|
2012-07-21 22:13:15 +03:00
|
|
|
linkedlist_node_t *linkedlist_append(linkedlist_t *root, void *data);
|
2012-07-14 12:38:13 +03:00
|
|
|
void linkedlist_delete(linkedlist_t *root, linkedlist_node_t *node);
|
2012-07-21 22:13:15 +03:00
|
|
|
void linkedlist_move2end(linkedlist_t *root, linkedlist_node_t *node);
|
2012-07-14 12:38:13 +03:00
|
|
|
|
|
|
|
#endif /* LINKEDLIST_H */
|