diff --git a/include/ilib/splay.h b/include/ilib/splay.h index 442bda9..6cca7e4 100644 --- a/include/ilib/splay.h +++ b/include/ilib/splay.h @@ -1,13 +1,28 @@ -/* splay tree implementation */ +/* + * this is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published + * by the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * this is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see ."; + * + * (c) Alexander Vdolainen 2007, 2026 + * subrelay: a minimalistic maillist server based on external IMAPs/SMTPs + * + * splay.h: splay tree implementation + * + */ #ifndef __SPLAY_H__ #define __SPLAY_H__ #include -#define tree_root_priv(T) ((T)->splay_sentinel.splay_left) -#define tree_null_priv(L) (&(L)->splay_sentinel) -#define TREE_DEPTH_MAX 64 - typedef long (*splay_compare_t)(const void*, const void*); typedef struct __splay_node_t { @@ -20,7 +35,6 @@ typedef struct __splay_node_t { typedef struct __splay_t { uint64_t nodecount; - uint64_t maxcount; splay_node_t splay_sentinel; splay_compare_t splay_compare; void *splay_context; diff --git a/src/splay.c b/src/splay.c index 6875bf6..78c22d5 100644 --- a/src/splay.c +++ b/src/splay.c @@ -1,4 +1,23 @@ -/* splay tree implementation */ +/* + * this is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published + * by the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * this is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see ."; + * + * (c) Alexander Vdolainen 2007, 2026 + * subrelay: a minimalistic maillist server based on external IMAPs/SMTPs + * + * splay.c: splay tree implementation + * + */ #include #include @@ -7,6 +26,9 @@ #include +#define tree_root_priv(T) ((T)->splay_sentinel.splay_left) +#define tree_null_priv(L) (&(L)->splay_sentinel) + static void splay_node(splay_t *, splay_node_t *); static void tree_rotate_left(splay_node_t *, splay_node_t *); static void tree_rotate_right(splay_node_t *, splay_node_t *); @@ -21,8 +43,6 @@ int splay_init(splay_t *sp, splay_compare_t cmp_fu) memset(sp, 0, sizeof(splay_t)); - /* FIXME: do better maxcount */ - sp->maxcount = 65535; sp->splay_compare = cmp_fu; /* tree init */