projects
/
oweals
/
tinc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0e71360
)
Extend list_t with the number of elements in the list.
author
Guus Sliepen
<guus@tinc-vpn.org>
Wed, 27 Mar 2002 15:01:16 +0000
(15:01 +0000)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Wed, 27 Mar 2002 15:01:16 +0000
(15:01 +0000)
lib/list.c
patch
|
blob
|
history
lib/list.h
patch
|
blob
|
history
diff --git
a/lib/list.c
b/lib/list.c
index 3082406fb63d5ae4f86151b0ba9b0d3898cde9a3..cb2d4d2104a2630c2a2e8209f6cac72bb8be9746 100644
(file)
--- a/
lib/list.c
+++ b/
lib/list.c
@@
-17,7
+17,7
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: list.c,v 1.1.2.
9 2001/02/25 15:34:50
guus Exp $
+ $Id: list.c,v 1.1.2.
10 2002/03/27 15:01:16
guus Exp $
*/
#include "config.h"
*/
#include "config.h"
@@
-81,6
+81,8
@@
list_node_t *list_insert_head(list_t *list, void *data)
else
list->tail = node;
else
list->tail = node;
+ list->count++;
+
return node;
}
return node;
}
@@
-100,6
+102,8
@@
list_node_t *list_insert_tail(list_t *list, void *data)
else
list->head = node;
else
list->head = node;
+ list->count++;
+
return node;
}
return node;
}
@@
-114,6
+118,8
@@
void list_unlink_node(list_t *list, list_node_t *node)
node->next->prev = node->prev;
else
list->tail = node->prev;
node->next->prev = node->prev;
else
list->tail = node->prev;
+
+ list->count--;
}
void list_delete_node(list_t *list, list_node_t *node)
}
void list_delete_node(list_t *list, list_node_t *node)
diff --git
a/lib/list.h
b/lib/list.h
index b62ab9921bc02d0c493c7ed5a5312984f9831c59..3e1735bfff29e95d468569d15861344fec17c65d 100644
(file)
--- a/
lib/list.h
+++ b/
lib/list.h
@@
-17,7
+17,7
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: list.h,v 1.1.2.
4 2001/01/07 17:08:50
guus Exp $
+ $Id: list.h,v 1.1.2.
5 2002/03/27 15:01:16
guus Exp $
*/
#ifndef __TINC_LIST_H__
*/
#ifndef __TINC_LIST_H__
@@
-40,6
+40,7
@@
typedef struct list_t
{
list_node_t *head;
list_node_t *tail;
{
list_node_t *head;
list_node_t *tail;
+ int count;
/* Callbacks */
/* Callbacks */