📄 list.h
字号:
/* $Id: list.h,v 1.11 2000/04/06 07:26:53 jm Exp $ * Header files for using list module * * Dynamic hierarchial IP tunnel * Copyright (C) 1998-2000, Dynamics group * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. See README and COPYING for * more details. */#ifndef LIST_H#define LIST_H/* defines *//* structures *//* node structure */struct node { struct node *succ; struct node *pred;};/* list structure *//* Field description: * * - head of list consists of succeeding node (head) and preceding node (tail) * head has never any preceding nodes, so 'tail' is always NULL * * - tail consists of succeeding node (tail) and preceding node (tailpred) * tail has never any succeeding nodes, so it 'tail' is always NULL * * Because tail is always NULL, the same pointer to node is at the same time * part of head node and tail node. * * | HEAD | <- succ | head | = succ of head * | NODE | <- pred = NULL * => | tail | = pred of head AND succ of tail * | TAIL | <- succ = NULL * | NODE | <- pred | tailpred | = pred of tail */struct list { struct node *head; /* | HEAD | starts here */ struct node *tail; /* | NODE | | TAIL | starts here */ struct node *tailpred; /* | NODE | */};/* prototypes */void list_init(struct list *list);void list_init_node(struct node *node);void list_add_head(struct list *list, struct node *node);void list_add_tail(struct list *list, struct node *node);void list_insert(struct list *list, struct node *node, struct node *listnode);#if 0void list_enqueue(struct list *list, struct node *node);#endifstruct node *list_get_first(struct list *list);struct node *list_get_first_node(struct node *node);struct node *list_get_next(struct node *node);struct node *list_remove_first(struct list *list);struct node *list_remove_last(struct list *list);void list_remove(struct node *node);#if 0struct node *list_find_name(const struct list *list, const char *name);struct node *list_find_name_node(struct node *node, const char *name);#endifint list_is_empty(const struct list *list);#endif /* LIST_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -