summaryrefslogtreecommitdiffstats
path: root/lib/skiplist.h
diff options
context:
space:
mode:
authorwhitespace / reindent <invalid@invalid.invalid>2017-07-17 14:03:14 +0200
committerwhitespace / reindent <invalid@invalid.invalid>2017-07-17 14:04:07 +0200
commitd62a17aedeb0eebdba98238874bb13d62c48dbf9 (patch)
tree3b319b1d61c8b85b4d1f06adf8b844bb8a9b5107 /lib/skiplist.h
parent*: add indent control files (diff)
downloadfrr-d62a17aedeb0eebdba98238874bb13d62c48dbf9.tar.xz
frr-d62a17aedeb0eebdba98238874bb13d62c48dbf9.zip
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/skiplist.h')
-rw-r--r--lib/skiplist.h178
1 files changed, 72 insertions, 106 deletions
diff --git a/lib/skiplist.h b/lib/skiplist.h
index 25775f754..a2e8c374b 100644
--- a/lib/skiplist.h
+++ b/lib/skiplist.h
@@ -1,5 +1,5 @@
/*
- * Copyright 1990 William Pugh
+ * Copyright 1990 William Pugh
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted.
@@ -33,127 +33,93 @@
#define SKIPLIST_0TIMER_DEBUG 1
-/*
+/*
* skiplistnodes must always contain data to be valid. Adding an
* empty node to a list is invalid
*/
-struct skiplistnode
-{
- void *key;
- void *value;
+struct skiplistnode {
+ void *key;
+ void *value;
#if SKIPLIST_0TIMER_DEBUG
- int flags;
+ int flags;
#define SKIPLIST_NODE_FLAG_INSERTED 0x00000001
#endif
- struct skiplistnode *forward[1]; /* variable sized */
+ struct skiplistnode *forward[1]; /* variable sized */
};
-struct skiplist
-{
- int flags;
+struct skiplist {
+ int flags;
#define SKIPLIST_FLAG_ALLOW_DUPLICATES 0x00000001
- int level; /* max lvl (1 + current # of levels in list) */
- unsigned int count;
- struct skiplistnode *header;
- struct skiplistnode *stats;
- struct skiplistnode *last; /* last real list item (NULL if empty list) */
-
- /*
- * Returns -1 if val1 < val2, 0 if equal?, 1 if val1 > val2.
- * Used as definition of sorted for listnode_add_sort
- */
- int (*cmp) (void *val1, void *val2);
-
- /* callback to free user-owned data when listnode is deleted. supplying
- * this callback is very much encouraged!
- */
- void (*del) (void *val);
+ int level; /* max lvl (1 + current # of levels in list) */
+ unsigned int count;
+ struct skiplistnode *header;
+ struct skiplistnode *stats;
+ struct skiplistnode
+ *last; /* last real list item (NULL if empty list) */
+
+ /*
+ * Returns -1 if val1 < val2, 0 if equal?, 1 if val1 > val2.
+ * Used as definition of sorted for listnode_add_sort
+ */
+ int (*cmp)(void *val1, void *val2);
+
+ /* callback to free user-owned data when listnode is deleted. supplying
+ * this callback is very much encouraged!
+ */
+ void (*del)(void *val);
};
/* Prototypes. */
extern struct skiplist *
-skiplist_new( /* encouraged: set list.del callback on new lists */
- int flags,
- int (*cmp) (void *key1, void *key2), /* NULL => default cmp */
- void (*del) (void *val)); /* NULL => no auto val free */
-
-extern void
-skiplist_free (struct skiplist *);
-
-extern int
-skiplist_insert(
- register struct skiplist *l,
- register void *key,
- register void *value);
-
-extern int
-skiplist_delete(
- register struct skiplist *l,
- register void *key,
- register void *value);
-
-extern int
-skiplist_search(
- register struct skiplist *l,
- register void *key,
- void **valuePointer);
-
-extern int
-skiplist_first_value(
- register struct skiplist *l, /* in */
- register void *key, /* in */
- void **valuePointer, /* in/out */
- void **cursor); /* out */
-
-extern int
-skiplist_next_value(
- register struct skiplist *l, /* in */
- register void *key, /* in */
- void **valuePointer, /* in/out */
- void **cursor); /* in/out */
-
-extern int
-skiplist_first(
- register struct skiplist *l,
- void **keyPointer,
- void **valuePointer);
-
-extern int
-skiplist_last(
- register struct skiplist *l,
- void **keyPointer,
- void **valuePointer);
-
-extern int
-skiplist_delete_first(
- register struct skiplist *l);
-
-extern int
-skiplist_next(
- register struct skiplist *l, /* in */
- void **keyPointer, /* out */
- void **valuePointer, /* out */
- void **cursor); /* in/out */
-
-extern int
-skiplist_empty(
- register struct skiplist *l); /* in */
-
-extern unsigned int
-skiplist_count(
- register struct skiplist *l); /* in */
-
-extern void
-skiplist_debug(
- struct vty *vty,
- struct skiplist *l);
-
-extern void
-skiplist_test(
- struct vty *vty);
+skiplist_new(/* encouraged: set list.del callback on new lists */
+ int flags,
+ int (*cmp)(void *key1, void *key2), /* NULL => default cmp */
+ void (*del)(void *val)); /* NULL => no auto val free */
+
+extern void skiplist_free(struct skiplist *);
+
+extern int skiplist_insert(register struct skiplist *l, register void *key,
+ register void *value);
+
+extern int skiplist_delete(register struct skiplist *l, register void *key,
+ register void *value);
+
+extern int skiplist_search(register struct skiplist *l, register void *key,
+ void **valuePointer);
+
+extern int skiplist_first_value(register struct skiplist *l, /* in */
+ register void *key, /* in */
+ void **valuePointer, /* in/out */
+ void **cursor); /* out */
+
+extern int skiplist_next_value(register struct skiplist *l, /* in */
+ register void *key, /* in */
+ void **valuePointer, /* in/out */
+ void **cursor); /* in/out */
+
+extern int skiplist_first(register struct skiplist *l, void **keyPointer,
+ void **valuePointer);
+
+extern int skiplist_last(register struct skiplist *l, void **keyPointer,
+ void **valuePointer);
+
+extern int skiplist_delete_first(register struct skiplist *l);
+
+extern int skiplist_next(register struct skiplist *l, /* in */
+ void **keyPointer, /* out */
+ void **valuePointer, /* out */
+ void **cursor); /* in/out */
+
+extern int skiplist_empty(register struct skiplist *l); /* in */
+
+extern unsigned int skiplist_count(register struct skiplist *l); /* in */
+
+extern void skiplist_debug(struct vty *vty, struct skiplist *l);
+
+extern void skiplist_test(struct vty *vty);
#endif /* _ZEBRA_SKIPLIST_H */