summaryrefslogtreecommitdiff
path: root/src/libdatastruct
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2014-12-20 12:34:14 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2014-12-20 12:34:14 +0000
commit0d82edd9f8bebb396a9154d4e1003340dbf6b967 (patch)
tree0659c834f387f3504944a610ed6858b9e268e6c7 /src/libdatastruct
parent2436785702b47996e9f0e281df0d6027660ec914 (diff)
downloadskalibs-0d82edd9f8bebb396a9154d4e1003340dbf6b967.tar.xz
Lots of cosmetic fixes.
sha256 documented.
Diffstat (limited to 'src/libdatastruct')
-rw-r--r--src/libdatastruct/avlnode-internal.h4
-rw-r--r--src/libdatastruct/avlnode_insertnode.c2
-rw-r--r--src/libdatastruct/avlnode_iter.c4
-rw-r--r--src/libdatastruct/avlnode_rotate.c2
-rw-r--r--src/libdatastruct/avltree_delete.c2
-rw-r--r--src/libdatastruct/avltree_free.c2
-rw-r--r--src/libdatastruct/avltree_init.c2
-rw-r--r--src/libdatastruct/avltree_newnode.c4
-rw-r--r--src/libdatastruct/avltreen_delete.c2
-rw-r--r--src/libdatastruct/avltreen_init.c2
-rw-r--r--src/libdatastruct/avltreen_insert.c2
-rw-r--r--src/libdatastruct/avltreen_newnode.c4
-rw-r--r--src/libdatastruct/genset.c6
-rw-r--r--src/libdatastruct/genset_iter.c2
-rw-r--r--src/libdatastruct/gensetdyn_delete.c2
-rw-r--r--src/libdatastruct/gensetdyn_free.c2
-rw-r--r--src/libdatastruct/gensetdyn_init.c2
-rw-r--r--src/libdatastruct/gensetdyn_iter.c2
-rw-r--r--src/libdatastruct/gensetdyn_new.c2
-rw-r--r--src/libdatastruct/gensetdyn_ready.c2
20 files changed, 26 insertions, 26 deletions
diff --git a/src/libdatastruct/avlnode-internal.h b/src/libdatastruct/avlnode-internal.h
index 0342695..2151cf3 100644
--- a/src/libdatastruct/avlnode-internal.h
+++ b/src/libdatastruct/avlnode-internal.h
@@ -8,8 +8,8 @@
#define avlnode_ufroms(c) ((c) > 0)
#define avlnode_sfromu(h) ((h) ? 1 : -1)
-extern unsigned int avlnode_rotate (avlnode_ref, unsigned int, unsigned int, int) ;
-extern unsigned int avlnode_doublerotate (avlnode_ref, unsigned int, unsigned int, int) ;
+extern unsigned int avlnode_rotate (avlnode *, unsigned int, unsigned int, int) ;
+extern unsigned int avlnode_doublerotate (avlnode *, unsigned int, unsigned int, int) ;
#define avlnode_rotate_maydouble(s, max, r, h, isdouble) ((isdouble) ? avlnode_doublerotate(s, max, r, h) : avlnode_rotate(s, max, r, h))
#endif
diff --git a/src/libdatastruct/avlnode_insertnode.c b/src/libdatastruct/avlnode_insertnode.c
index c69b34e..ac44877 100644
--- a/src/libdatastruct/avlnode_insertnode.c
+++ b/src/libdatastruct/avlnode_insertnode.c
@@ -4,7 +4,7 @@
#include <skalibs/avlnode.h>
#include "avlnode-internal.h"
-unsigned int avlnode_insertnode (avlnode_ref s, unsigned int max, unsigned int r, unsigned int i, dtokfunc_t_ref dtok, cmpfunc_t_ref f, void *p)
+unsigned int avlnode_insertnode (avlnode *s, unsigned int max, unsigned int r, unsigned int i, dtokfunc_t_ref dtok, cmpfunc_t_ref f, void *p)
{
unsigned int stack[AVLNODE_MAXDEPTH] ;
int spin[AVLNODE_MAXDEPTH] ;
diff --git a/src/libdatastruct/avlnode_iter.c b/src/libdatastruct/avlnode_iter.c
index 9e1d698..c6064f3 100644
--- a/src/libdatastruct/avlnode_iter.c
+++ b/src/libdatastruct/avlnode_iter.c
@@ -4,7 +4,7 @@
struct avlnode_iter_s
{
- avlnode_ref s ;
+ avlnode *s ;
unsigned int max ;
avliterfunc_t_ref f ;
void *p ;
@@ -19,7 +19,7 @@ static int avlnode_iter_rec (struct avlnode_iter_s const *blah, unsigned int r,
: 1 ;
}
-int avlnode_iter (avlnode_ref s, unsigned int max, unsigned int r, avliterfunc_t_ref f, void *p)
+int avlnode_iter (avlnode *s, unsigned int max, unsigned int r, avliterfunc_t_ref f, void *p)
{
struct avlnode_iter_s blah = { s, max, f, p } ;
return avlnode_iter_rec(&blah, r, 0) ;
diff --git a/src/libdatastruct/avlnode_rotate.c b/src/libdatastruct/avlnode_rotate.c
index fe06994..f2f75d7 100644
--- a/src/libdatastruct/avlnode_rotate.c
+++ b/src/libdatastruct/avlnode_rotate.c
@@ -3,7 +3,7 @@
#include <skalibs/avlnode.h>
#include "avlnode-internal.h"
-unsigned int avlnode_rotate (avlnode_ref s, unsigned int max, unsigned int i, int h)
+unsigned int avlnode_rotate (avlnode *s, unsigned int max, unsigned int i, int h)
{
register unsigned int j = s[i].child[!h] ;
s[i].child[!h] = s[j].child[h] ;
diff --git a/src/libdatastruct/avltree_delete.c b/src/libdatastruct/avltree_delete.c
index 5127f01..682877c 100644
--- a/src/libdatastruct/avltree_delete.c
+++ b/src/libdatastruct/avltree_delete.c
@@ -5,7 +5,7 @@
#include <skalibs/avlnode.h>
#include <skalibs/avltree.h>
-int avltree_delete (avltree_ref t, void const *k)
+int avltree_delete (avltree *t, void const *k)
{
unsigned int r = avltree_root(t) ;
unsigned int i = avlnode_delete(avltree_nodes(t), avltree_totalsize(t), &r, k, t->dtok, t->kcmp, t->external) ;
diff --git a/src/libdatastruct/avltree_free.c b/src/libdatastruct/avltree_free.c
index 14198fe..161004a 100644
--- a/src/libdatastruct/avltree_free.c
+++ b/src/libdatastruct/avltree_free.c
@@ -3,7 +3,7 @@
#include <skalibs/gensetdyn.h>
#include <skalibs/avltree.h>
-void avltree_free (avltree_ref t)
+void avltree_free (avltree *t)
{
gensetdyn_free(&t->x) ;
*t = avltree_zero ;
diff --git a/src/libdatastruct/avltree_init.c b/src/libdatastruct/avltree_init.c
index 290ff64..b4bfbe5 100644
--- a/src/libdatastruct/avltree_init.c
+++ b/src/libdatastruct/avltree_init.c
@@ -6,7 +6,7 @@
#include <skalibs/avlnode.h>
#include <skalibs/avltree.h>
-void avltree_init (avltree_ref t, unsigned int base, unsigned int fracnum, unsigned int fracden, dtokfunc_t_ref dtok, cmpfunc_t_ref f, void *p)
+void avltree_init (avltree *t, unsigned int base, unsigned int fracnum, unsigned int fracden, dtokfunc_t_ref dtok, cmpfunc_t_ref f, void *p)
{
gensetdyn_init(&t->x, sizeof(avlnode), base, fracnum, fracden) ;
t->root = (unsigned int)-1 ;
diff --git a/src/libdatastruct/avltree_newnode.c b/src/libdatastruct/avltree_newnode.c
index dc972a0..934da2c 100644
--- a/src/libdatastruct/avltree_newnode.c
+++ b/src/libdatastruct/avltree_newnode.c
@@ -5,11 +5,11 @@
#include <skalibs/avlnode.h>
#include <skalibs/avltree.h>
-int avltree_newnode (avltree_ref t, unsigned int data, unsigned int *i)
+int avltree_newnode (avltree *t, unsigned int data, unsigned int *i)
{
if (!gensetdyn_new(&t->x, i)) return 0 ;
{
- register avlnode_ref s = avltree_nodes(t) ;
+ register avlnode *s = avltree_nodes(t) ;
s[*i].data = data ;
s[*i].child[0] = s[*i].child[1] = (unsigned int)-1 ;
s[*i].balance = 0 ;
diff --git a/src/libdatastruct/avltreen_delete.c b/src/libdatastruct/avltreen_delete.c
index bfe85c5..ecf6ea4 100644
--- a/src/libdatastruct/avltreen_delete.c
+++ b/src/libdatastruct/avltreen_delete.c
@@ -5,7 +5,7 @@
#include <skalibs/avlnode.h>
#include <skalibs/avltreen.h>
-int avltreen_delete (avltreen_ref t, void const *k)
+int avltreen_delete (avltreen *t, void const *k)
{
unsigned int r = avltreen_root(t) ;
unsigned int i = avlnode_delete(avltreen_nodes(t), avltreen_totalsize(t), &r, k, t->dtok, t->kcmp, t->external) ;
diff --git a/src/libdatastruct/avltreen_init.c b/src/libdatastruct/avltreen_init.c
index 5e141b1..b4172b8 100644
--- a/src/libdatastruct/avltreen_init.c
+++ b/src/libdatastruct/avltreen_init.c
@@ -5,7 +5,7 @@
#include <skalibs/avlnode.h>
#include <skalibs/avltreen.h>
-void avltreen_init (avltreen_ref t, avlnode_ref storage, unsigned int *freelist, unsigned int size, dtokfunc_t_ref dtok, cmpfunc_t_ref f, void *p)
+void avltreen_init (avltreen *t, avlnode_ref storage, unsigned int *freelist, unsigned int size, dtokfunc_t_ref dtok, cmpfunc_t_ref f, void *p)
{
GENSET_init(&t->x, avlnode, storage, freelist, size) ;
t->root = size ;
diff --git a/src/libdatastruct/avltreen_insert.c b/src/libdatastruct/avltreen_insert.c
index 795216d..b3d24d0 100644
--- a/src/libdatastruct/avltreen_insert.c
+++ b/src/libdatastruct/avltreen_insert.c
@@ -2,7 +2,7 @@
#include <skalibs/avltreen.h>
-int avltreen_insert (avltreen_ref t, unsigned int d)
+int avltreen_insert (avltreen *t, unsigned int d)
{
unsigned int i = avltreen_newnode(t, d) ;
if (i >= avltreen_totalsize(t)) return 0 ;
diff --git a/src/libdatastruct/avltreen_newnode.c b/src/libdatastruct/avltreen_newnode.c
index 335025c..62b08e2 100644
--- a/src/libdatastruct/avltreen_newnode.c
+++ b/src/libdatastruct/avltreen_newnode.c
@@ -4,12 +4,12 @@
#include <skalibs/avlnode.h>
#include <skalibs/avltreen.h>
-unsigned int avltreen_newnode (avltreen_ref t, unsigned int d)
+unsigned int avltreen_newnode (avltreen *t, unsigned int d)
{
register unsigned int i = genset_new(&t->x) ;
if (i < avltreen_totalsize(t))
{
- register avlnode_ref s = avltreen_nodes(t) ;
+ register avlnode *s = avltreen_nodes(t) ;
s[i].data = d ;
s[i].child[0] = s[i].child[1] = avltreen_totalsize(t) ;
s[i].balance = 0 ;
diff --git a/src/libdatastruct/genset.c b/src/libdatastruct/genset.c
index 8d750b7..c8fc36e 100644
--- a/src/libdatastruct/genset.c
+++ b/src/libdatastruct/genset.c
@@ -3,7 +3,7 @@
#include <errno.h>
#include <skalibs/genset.h>
-void genset_init (genset_ref x, void *storage, unsigned int *freelist, unsigned int esize, unsigned int max)
+void genset_init (genset *x, void *storage, unsigned int *freelist, unsigned int esize, unsigned int max)
{
register unsigned int i = 0 ;
x->storage = (char *)storage ;
@@ -14,12 +14,12 @@ void genset_init (genset_ref x, void *storage, unsigned int *freelist, unsigned
for (; i < max ; i++) freelist[i] = max - 1 - i ;
}
-unsigned int genset_new (genset_ref x)
+unsigned int genset_new (genset *x)
{
return x->sp ? x->freelist[--x->sp] : (errno = ENOSPC, x->max) ;
}
-int genset_delete (genset_ref x, unsigned int i)
+int genset_delete (genset *x, unsigned int i)
{
if ((i >= x->max) || (x->sp >= x->max)) return (errno = EINVAL, 0) ;
x->freelist[x->sp++] = i ;
diff --git a/src/libdatastruct/genset_iter.c b/src/libdatastruct/genset_iter.c
index cc6e863..fba95de 100644
--- a/src/libdatastruct/genset_iter.c
+++ b/src/libdatastruct/genset_iter.c
@@ -4,7 +4,7 @@
#include <skalibs/functypes.h>
#include <skalibs/genset.h>
-unsigned int genset_iter (genset_ref g, iterfunc_t_ref f, void *stuff)
+unsigned int genset_iter (genset *g, iterfunc_t_ref f, void *stuff)
{
unsigned char bits[bitarray_div8(g->max)] ;
unsigned int i = 0, j = 0, n = 0, m = genset_n(g) ;
diff --git a/src/libdatastruct/gensetdyn_delete.c b/src/libdatastruct/gensetdyn_delete.c
index 58aec05..cfa15cf 100644
--- a/src/libdatastruct/gensetdyn_delete.c
+++ b/src/libdatastruct/gensetdyn_delete.c
@@ -4,7 +4,7 @@
#include <skalibs/genalloc.h>
#include <skalibs/gensetdyn.h>
-int gensetdyn_delete (gensetdyn_ref g, unsigned int i)
+int gensetdyn_delete (gensetdyn *g, unsigned int i)
{
return (i >= g->storage.len) ? (errno = EINVAL, 0) :
genalloc_catb(unsigned int, &g->freelist, &i, 1) ;
diff --git a/src/libdatastruct/gensetdyn_free.c b/src/libdatastruct/gensetdyn_free.c
index c0a4366..b0e03ad 100644
--- a/src/libdatastruct/gensetdyn_free.c
+++ b/src/libdatastruct/gensetdyn_free.c
@@ -4,7 +4,7 @@
#include <skalibs/genalloc.h>
#include <skalibs/gensetdyn.h>
-void gensetdyn_free (gensetdyn_ref g)
+void gensetdyn_free (gensetdyn *g)
{
stralloc_free(&g->storage) ;
genalloc_free(unsigned int, &g->freelist) ;
diff --git a/src/libdatastruct/gensetdyn_init.c b/src/libdatastruct/gensetdyn_init.c
index cff6ff5..7cfdf86 100644
--- a/src/libdatastruct/gensetdyn_init.c
+++ b/src/libdatastruct/gensetdyn_init.c
@@ -4,7 +4,7 @@
#include <skalibs/genalloc.h>
#include <skalibs/gensetdyn.h>
-void gensetdyn_init (gensetdyn_ref g, unsigned int esize, unsigned int base, unsigned int fracnum, unsigned int fracden)
+void gensetdyn_init (gensetdyn *g, unsigned int esize, unsigned int base, unsigned int fracnum, unsigned int fracden)
{
g->storage = stralloc_zero ;
g->freelist = genalloc_zero ;
diff --git a/src/libdatastruct/gensetdyn_iter.c b/src/libdatastruct/gensetdyn_iter.c
index 216d42b..51d598b 100644
--- a/src/libdatastruct/gensetdyn_iter.c
+++ b/src/libdatastruct/gensetdyn_iter.c
@@ -4,7 +4,7 @@
#include <skalibs/functypes.h>
#include <skalibs/gensetdyn.h>
-unsigned int gensetdyn_iter (gensetdyn_ref g, iterfunc_t_ref f, void *stuff)
+unsigned int gensetdyn_iter (gensetdyn *g, iterfunc_t_ref f, void *stuff)
{
/*
XXX: we may be called by a freeing function, so we cannot alloc -
diff --git a/src/libdatastruct/gensetdyn_new.c b/src/libdatastruct/gensetdyn_new.c
index 6a49189..5e199b3 100644
--- a/src/libdatastruct/gensetdyn_new.c
+++ b/src/libdatastruct/gensetdyn_new.c
@@ -3,7 +3,7 @@
#include <skalibs/genalloc.h>
#include <skalibs/gensetdyn.h>
-int gensetdyn_new (gensetdyn_ref g, unsigned int *i)
+int gensetdyn_new (gensetdyn *g, unsigned int *i)
{
register unsigned int n ;
if (!genalloc_len(unsigned int, &g->freelist) && !gensetdyn_readyplus(g, 1)) return 0 ;
diff --git a/src/libdatastruct/gensetdyn_ready.c b/src/libdatastruct/gensetdyn_ready.c
index d1cfd9f..8418e1a 100644
--- a/src/libdatastruct/gensetdyn_ready.c
+++ b/src/libdatastruct/gensetdyn_ready.c
@@ -4,7 +4,7 @@
#include <skalibs/genalloc.h>
#include <skalibs/gensetdyn.h>
-int gensetdyn_ready (gensetdyn_ref g, unsigned int n)
+int gensetdyn_ready (gensetdyn *g, unsigned int n)
{
int wasnull = !g->storage.s ;
unsigned int i = g->storage.len ;