summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2018-09-30 17:41:21 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2018-09-30 17:41:21 +0000
commit9575ac2abacc87c4167d419e5a1fa1d650dee11d (patch)
treeb1ae4bf0610127e8df4adc4555e0642328b60371
parent9eaecb924f06c8aaa84e6c55580b00d3ee708442 (diff)
downloadskalibs-9575ac2abacc87c4167d419e5a1fa1d650dee11d.tar.xz
Scrap avltreeb, prepare for 2.8.0.0
-rw-r--r--AUTHORS1
-rw-r--r--NEWS9
-rw-r--r--doc/index.html2
-rw-r--r--doc/license.html2
-rw-r--r--doc/upgrade.html7
-rw-r--r--package/info2
-rw-r--r--src/include/skalibs/avltreen.h50
7 files changed, 33 insertions, 40 deletions
diff --git a/AUTHORS b/AUTHORS
index 91c21de..69c8b8e 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -32,3 +32,4 @@ Thanks to:
Éric Le Bihan <eric.le.bihan.dev@free.fr>
Samuel Holland <samuel@sholland.org>
Jan Bramkamp <crest_maintainer@rlwinm.de>
+ John Regan <john@jrjrtech.com>
diff --git a/NEWS b/NEWS
index cc81894..84e4778 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,14 @@
Changelog for skalibs.
+In 2.8.0.0
+----------
+
+ - Bugfixes.
+ - avltreeb removed. (It used VLAs inside of structures, which is
+GNU C, not C99.) The AVLTREEN_DECLARE_AND_INIT() macro should be
+used instead.
+
+
In 2.7.0.0
----------
diff --git a/doc/index.html b/doc/index.html
index 491b54c..d66d1f7 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -60,7 +60,7 @@ with a standard C development environment </li>
<h3> Download </h3>
<ul>
- <li> The current released version of skalibs is <a href="skalibs-2.7.0.0.tar.gz">2.7.0.0</a>. </li>
+ <li> The current released version of skalibs is <a href="skalibs-2.8.0.0.tar.gz">2.8.0.0</a>. </li>
<li> Alternatively, you can checkout a copy of the
<a href="//git.skarnet.org/cgi-bin/cgit.cgi/skalibs/">skalibs
git repository</a>:
diff --git a/doc/license.html b/doc/license.html
index 9565d50..20e3820 100644
--- a/doc/license.html
+++ b/doc/license.html
@@ -74,7 +74,7 @@ color, or different text font. </li>
<p>
<em>I am aware that the previous restrictions sound completely
ridiculous while the official skalibs documentation is incomplete.
-As of 2.7.0.0, I'm not going to enforce those restrictions, but if you're
+As of 2.8.0.0, I'm not going to enforce those restrictions, but if you're
going to provide documentation for skalibs, don't keep it to yourself,
please send it to me instead. :-) </em>
</p>
diff --git a/doc/upgrade.html b/doc/upgrade.html
index e588c1c..83a574a 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -16,6 +16,13 @@
<a href="//skarnet.org/">skarnet.org</a>
</p>
+<h2> in 2.8.0.0 </h2>
+
+<ul>
+ <li> The avltreeb macros have been removed. Instead, the
+<tt>AVLTREEN_DECLARE_AND_INIT() macro has been added. </li>
+</ul>
+
<h2> in 2.7.0.0 </h2>
<ul>
diff --git a/package/info b/package/info
index e818718..eefff5d 100644
--- a/package/info
+++ b/package/info
@@ -1,4 +1,4 @@
package=skalibs
-version=2.7.0.0
+version=2.8.0.0
category=prog
package_macro_name=SKALIBS
diff --git a/src/include/skalibs/avltreen.h b/src/include/skalibs/avltreen.h
index c8af35e..51e8fd0 100644
--- a/src/include/skalibs/avltreen.h
+++ b/src/include/skalibs/avltreen.h
@@ -8,8 +8,13 @@
#include <skalibs/genset.h>
#include <skalibs/avlnode.h>
-
- /* avltreen: just the structure. Storage and freelist are outside. */
+ /*
+ avltreen is the structure managing the AVL tree.
+ It needs pre-declared arrays: "storage", an array of avlnode,
+ and "freelist", an array of uint32_t, given as arguments to
+ avltreen_init(). Pointers to those arrays are then stored in
+ the genset.
+ */
typedef struct avltreen_s avltreen, *avltreen_ref ;
struct avltreen_s
@@ -30,9 +35,14 @@ struct avltreen_s
#define avltreen_setroot(t, r) ((t)->root = (r))
extern void avltreen_init (avltreen *, avlnode *, uint32_t *, uint32_t, dtokfunc_t_ref, cmpfunc_t_ref, void *) ;
+#define AVLTREEN_DECLARE_AND_INIT(name, size, dtk, cmp, p) \
+avlnode name##_storage[size] ; \
+uint32_t name##_freelist[size] ; \
+avltreen name ; \
+avltreen_init(&name, name##_storage, name##_freelist, size, dtk, cmp, p)
+
#define avltreen_searchnode(t, k) avlnode_searchnode(avltreen_nodes(t), avltreen_totalsize(t), avltreen_root(t), (k), (t)->dtok, (t)->kcmp, (t)->external)
#define avltreen_search(t, k, data) avlnode_search(avltreen_nodes(t), avltreen_totalsize(t), avltreen_root(t), k, (data), (t)->dtok, (t)->kcmp, (t)->external)
-
#define avltreen_height(t) avlnode_height(avltreen_nodes(t), avltreen_totalsize(t), avltreen_root(t))
#define avltreen_extremenode(t, h) avlnode_extremenode(avltreen_nodes(t), avltreen_totalsize(t), avltreen_root(t), h)
@@ -53,38 +63,4 @@ extern int avltreen_delete (avltreen *, void const *) ;
#define avltreen_iter_nocancel(t, cut, f, p) avlnode_iter_nocancel(avltreen_nodes(t), avltreen_totalsize(t), cut, avltreen_root(t), f, p)
#define avltreen_iter_withcancel(t, f, cancelf, p) avlnode_iter_withcancel(avltreen_nodes(t), avltreen_totalsize(t), avltreen_root(t), f, cancelf, p)
-
- /* avltreeb: everything in one place. Stack or BSS, or heap if you insist */
-
-#define AVLTREEB_TYPE(size) struct { avlnode storage[size] ; uint32_t freelist[size] ; avltreen info ; }
-#define avltreeb_init(t, size, dtk, f, p) avltreen_init(&(t)->info, (t)->storage, (t)->freelist, size, dtk, f, p)
-#define avltreeb_totalsize(t) avltreen_totalsize(&(t)->info)
-#define avltreeb_len(t) avltreen_len(&(t)->info)
-#define avltreeb_nodes(t) ((avlnode *)(t)->storage)
-#define avltreeb_data(t, i) (avltreeb_nodes(t)[i].data)
-#define avltreeb_root(t) ((t)->info.root)
-#define avltreeb_setroot(t, r) ((t)->info.root = (r))
-
-#define avltreeb_searchnode(t, k) avlnode_searchnode(avltreeb_nodes(t), avltreeb_totalsize(t), avltreeb_root(t), (k), (t)->info.dtok, (t)->info.kcmp, (t)->info.external)
-#define avltreeb_search(t, k, data) avlnode_search(avltreeb_nodes(t), avltreeb_totalsize(t), avltreeb_root(t), k, (data), (t)->info.dtok, (t)->info.kcmp, (t)->info.external)
-#define avltreeb_height(t) avlnode_height(avltreeb_nodes(t), avltreeb_totalsize(t), avltreeb_root(t))
-
-#define avltreeb_extremenode(t, h) avlnode_extremenode(avltreeb_nodes(t), avltreeb_totalsize(t), avltreeb_root(t), h)
-#define avltreeb_minnode(t) avltreeb_extremenode((t), 0)
-#define avltreeb_maxnode(t) avltreeb_extremenode((t), 1)
-
-#define avltreeb_extreme(t, h, data) avlnode_extreme(avltreeb_nodes(t), avltreeb_totalsize(t), avltreeb_root(t), h, data)
-#define avltreeb_min(t, data) avltreeb_extreme((t), 0, data)
-#define avltreeb_max(t, data) avltreeb_extreme((t), 1, data)
-
-#define avltreeb_newnode(t, d) avltreen_newnode(&(t)->info, d)
-#define avltreeb_insertnode(t, i) avltreeb_setroot(t, avlnode_insertnode(avltreeb_nodes(t), avltreeb_totalsize(t), avltreeb_root(t), (i), (t)->info.dtok, (t)->info.kcmp, (t)->info.external))
-#define avltreeb_insert(t, d) avltreen_insert(&(t)->info, d)
-
-#define avltreeb_delete(t, k) avltreen_delete(&(t)->info, k)
-
-#define avltreeb_iter(t, f, p) avlnode_iter(avltreeb_nodes(t), avltreeb_totalsize(t), avltreeb_root(t), f, p)
-#define avltreeb_iter_nocancel(t, cut, f, p) avlnode_iter_nocancel(avltreeb_nodes(t), avltreeb_totalsize(t), cut, avltreeb_root(t), f, p)
-#define avltreeb_iter_withcancel(t, f, cancelf, p) avlnode_iter_withcancel(avltreeb_nodes(t), avltreeb_totalsize(t), avltreeb_root(t), f, cancelf, p)
-
#endif