ze-filter  (ze-filter-0.8.0-develop-180218)
zeBTree.c
Go to the documentation of this file.
1 /*
2  *
3  * ze-filter - Mail Server Filter for sendmail
4  *
5  * Copyright (c) 2001-2018 - Jose-Marcio Martins da Cruz
6  *
7  * Auteur : Jose Marcio Martins da Cruz
8  * jose.marcio.mc@gmail.org
9  *
10  * Historique :
11  * Creation : janvier 2002
12  *
13  * This program is free software, but with restricted license :
14  *
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19  *
20  * More details about ze-filter license can be found at ze-filter
21  * web site : http://foss.jose-marcio.org
22  */
23 
24 #include <ze-sys.h>
25 
26 #include <zeBTree.h>
27 
28 #include "libze.h"
29 
30 
31 /* ****************************************************************************
32  * *
33  * *
34  **************************************************************************** */
35 
36 #define _DB_LH -1
37 #define _DB_EH 0
38 #define _DB_RH 1
39 
40 struct ZEBTREC_T
41 {
44  int balance;
45  void *data;
46 };
47 
48 static bool zeBTree_Destroy_tree(ZEBTREC_T *);
49 
50 static bool zeBTree_Add_node(ZEBT_T *, void *, ZEBTREC_T **, bool *);
51 
52 static ZEBTREC_T *zeBTree_Del_node(ZEBT_T *, void *, ZEBTREC_T *, bool *);
53 
54 static ZEBTREC_T *zeBTree_Get_node(ZEBT_T *, void *, ZEBTREC_T *);
55 
56 static int zeBTree_Browse_tree(ZEBT_T *, ZEBT_BROWSE_F, ZEBTREC_T *, void *);
57 static bool zeBTree_Cpy_tree(ZEBT_T *, ZEBTREC_T *, ZEBT_SEL_F, void *);
58 
59 static ZEBTREC_T *zeBTree_Node_Alloc(ZEBT_T *, void *);
60 
61 static ZEBTREC_T *zeBTree_Rotate_Left(ZEBTREC_T *);
62 static ZEBTREC_T *zeBTree_Rotate_Right(ZEBTREC_T *);
63 
64 static ZEBTREC_T *zeBTree_Left_Balance(ZEBTREC_T *);
65 static ZEBTREC_T *zeBTree_Right_Balance(ZEBTREC_T *);
66 
67 static int jlog2(int);
68 
70 
71 /* ****************************************************************************
72  * *
73  * *
74  **************************************************************************** */
75 
76 #define JBT_LOCK(mutex) MUTEX_LOCK(mutex)
77 #define JBT_UNLOCK(mutex) MUTEX_UNLOCK(mutex)
78 
79 #define JBT_ZERO(jbth) \
80  do { \
81  jbth->signature = SIGNATURE; \
82  jbth->count = 0; \
83  jbth->size = 0; \
84  jbth->reccmp = NULL; \
85  jbth->root = NULL; \
86  jbth->chkCount = FALSE; \
87  jbth->maxCount = MAX_BTNODES; \
88  jbth->nbErr = 0; \
89  } while (0)
90 
91 /* ****************************************************************************
92  * *
93  * *
94  **************************************************************************** */
95 bool
96 zeBTree_Init(jdbh, size, reccmp)
97  ZEBT_T *jdbh;
98  size_t size;
99  ZEBT_CMP_F reccmp;
100 {
101  if (jdbh == NULL)
102  return FALSE;
103 
104  if (size <= 0)
105  return FALSE;
106 
107  if (reccmp == NULL)
108  return FALSE;
109 
110  if (jdbh->signature == SIGNATURE)
111  zeBTree_Destroy(jdbh);
112  else
113  memset(jdbh, 0, sizeof (ZEBT_T));
114 
115  jdbh->signature = SIGNATURE;
116  jdbh->count = 0;
117  jdbh->size = size;
118  jdbh->reccmp = reccmp;
119  jdbh->root = NULL;
120  jdbh->chkCount = FALSE;
121  jdbh->maxCount = MAX_BTNODES;
122 
123  return TRUE;
124 }
125 
126 /* ****************************************************************************
127  * *
128  * *
129  **************************************************************************** */
130 bool
132  ZEBT_T *jdbh;
133 {
134  if (jdbh == NULL)
135  return FALSE;
136 
137  if (jdbh->signature != SIGNATURE)
138  return FALSE;
139 
140  MUTEX_LOCK(&jdbh->mutex);
141 
142  return TRUE;
143 }
144 
145 
146 /* ****************************************************************************
147  * *
148  * *
149  **************************************************************************** */
150 bool
152  ZEBT_T *jdbh;
153 {
154  if (jdbh == NULL)
155  return FALSE;
156 
157  if (jdbh->signature != SIGNATURE)
158  return FALSE;
159 
160  MUTEX_UNLOCK(&jdbh->mutex);
161 
162  return TRUE;
163 }
164 
165 /* ****************************************************************************
166  * *
167  * *
168  **************************************************************************** */
169 bool
170 zeBTree_Set_BTree_Size(jdbh, chkCount, maxCount)
171  ZEBT_T *jdbh;
172  bool chkCount;
173  int maxCount;
174 {
175  if (jdbh == NULL)
176  return FALSE;
177 
178  if (jdbh->signature != SIGNATURE)
179  return FALSE;
180 
181  jdbh->chkCount = chkCount;
182  jdbh->maxCount = maxCount;
183 
184  return TRUE;
185 }
186 
187 /* ****************************************************************************
188  * *
189  * *
190  **************************************************************************** */
191 bool
193  ZEBT_T *jdbh;
194 {
195 
196  if (jdbh == NULL)
197  return FALSE;
198 
199  if (jdbh->signature != SIGNATURE)
200  return FALSE;
201 
202  (void) zeBTree_Destroy_tree(jdbh->root);
203 
204  jdbh->size = 0;
205  jdbh->count = 0;
206  jdbh->reccmp = NULL;
207  jdbh->root = NULL;
208 
209  memset(jdbh, 0, sizeof (ZEBT_T));
210 
211  jdbh->chkCount = FALSE;
212  jdbh->maxCount = MAX_BTNODES;
213 
214  return TRUE;
215 }
216 
217 /* ****************************************************************************
218  * *
219  * *
220  **************************************************************************** */
221 bool
223  ZEBT_T *jdbh;
224 {
225 
226  if (jdbh == NULL)
227  return FALSE;
228 
229  if (jdbh->signature != SIGNATURE)
230  return FALSE;
231 
232  (void) zeBTree_Destroy_tree(jdbh->root);
233 
234  jdbh->count = 0;
235  jdbh->root = NULL;
236 
237  return TRUE;
238 }
239 
240 /* ****************************************************************************
241  * *
242  * *
243  **************************************************************************** */
244 int
246  ZEBT_T *jdbh;
247 {
248  if (jdbh == NULL)
249  return 0;
250 
251  if (jdbh->signature != SIGNATURE)
252  return 0;
253 
254  return jdbh->count;
255 }
256 
257 /* ****************************************************************************
258  * *
259  * *
260  **************************************************************************** */
261 int
262 zeBTree_Browse(jdbh, func, data)
263  ZEBT_T *jdbh;
264  ZEBT_BROWSE_F func;
265  void *data;
266 {
267  if (jdbh == NULL)
268  return 0;
269 
270  if (jdbh->signature != SIGNATURE)
271  return 0;
272 
273  return zeBTree_Browse_tree(jdbh, func, jdbh->root, data);
274 }
275 
276 /* ****************************************************************************
277  * *
278  * *
279  **************************************************************************** */
280 void *
282  ZEBT_T *jdbh;
283  void *data;
284 {
285  ZEBTREC_T *node;
286 
287  if (jdbh == NULL)
288  return NULL;
289  if (data == NULL)
290  return NULL;
291 
292  if (jdbh->signature != SIGNATURE)
293  return NULL;
294 
295  node = zeBTree_Get_node(jdbh, data, jdbh->root);
296  if (node != NULL)
297  return node->data;
298 
299  return NULL;
300 }
301 
302 /* ****************************************************************************
303  * *
304  * *
305  **************************************************************************** */
306 #define MAX_BTERR 16
307 
308 bool
310  ZEBT_T *jdbh;
311  void *data;
312 {
313  bool ok = FALSE;
314 
315  if (jdbh == NULL)
316  return FALSE;
317  if (data == NULL)
318  return FALSE;
319 
320  if (jdbh->signature != SIGNATURE)
321  return FALSE;
322 
323 #if BUGGY_AVLTREE
324  return TRUE;
325 #endif
326 
327  if (jdbh->chkCount && (jdbh->count >= MAX_BTNODES))
328  {
329  if (jdbh->nbErr < MAX_BTERR)
330  ZE_LogMsgError(0, "Too much nodes in btree : %ld", (long) jdbh->count);
331  jdbh->nbErr++;
332  return FALSE;
333  }
334  jdbh->nbErr = 0;
335 
336  ZE_MessageInfo(19, " Adding...");
337 
338  {
339  bool taller = FALSE;
340 
341  ok = zeBTree_Add_node(jdbh, data, &(jdbh->root), &taller);
342  if (!ok)
343  ZE_LogMsgNotice(0, "zeBTree_Add_node returned NULL...");
344  }
345 
346  ZE_MessageInfo(19, " OK ... %d", jdbh->count);
347 
348  return ok;
349 }
350 
351 /* ****************************************************************************
352  * *
353  * *
354  **************************************************************************** */
355 bool
357  ZEBT_T *jdbh;
358  void *data;
359 {
360  ZEBTREC_T *root = NULL;
361  bool shorter = FALSE;
362 
363  if (jdbh->signature != SIGNATURE)
364  return FALSE;
365 
366  root = zeBTree_Del_node(jdbh, data, jdbh->root, &shorter);
367 
368  return TRUE;
369 }
370 
371 /* ****************************************************************************
372  * *
373  * *
374  **************************************************************************** */
375 static bool
376 zeBTree_Destroy_tree(root)
377  ZEBTREC_T *root;
378 {
379  if (root == NULL)
380  return TRUE;
381 
382  zeBTree_Destroy_tree(root->left);
383  root->left = NULL;
384 
385  FREE(root->data);
386 
387  zeBTree_Destroy_tree(root->right);
388  root->right = NULL;
389  FREE(root);
390 
391  return TRUE;
392 }
393 
394 /* ****************************************************************************
395  * *
396  * TO DO *** *
397  **************************************************************************** */
398 static ZEBTREC_T *
399 zeBTree_Del_node(jdbh, data, root, shorter)
400  ZEBT_T *jdbh;
401  void *data;
402  ZEBTREC_T *root;
403  bool *shorter;
404 {
405  int cmp;
406  ZEBTREC_T *res = root;
407 
408  if (jdbh == NULL)
409  {
410  /* JOE - ERROR */
411  return NULL;
412  }
413  if (data == NULL)
414  {
415  /* JOE - ERROR */
416  return NULL;
417  }
418 
419  if (root == NULL)
420  {
421  /* XXX */
422  return root;
423  }
424 
425  if ((cmp = (*jdbh->reccmp) (data, root->data)) == 0)
426  {
427  /* XXX */
428  return NULL;
429  }
430  if (cmp < 0)
431  {
432  }
433  if (cmp > 0)
434  {
435  }
436  return res;
437 }
438 
439 /* ****************************************************************************
440  * *
441  * *
442  **************************************************************************** */
443 ZEBTREC_T *
444 zeBTree_Get_node(jdbh, data, root)
445  ZEBT_T *jdbh;
446  void *data;
447  ZEBTREC_T *root;
448 {
449  int res = 0;
450 
451  if (jdbh == NULL)
452  return NULL;
453  if (data == NULL)
454  return NULL;
455  if (root == NULL)
456  return NULL;
457 
458  if (root->data == NULL)
459  {
460  ZE_LogMsgWarning(0, "root not NULL but root->data is NULL...");
461  return NULL;
462  }
463 
464  res = jdbh->reccmp(data, root->data);
465 
466  if (res == 0)
467  return root;
468  if (res < 0)
469  return zeBTree_Get_node(jdbh, data, root->left);
470  if (res > 0)
471  return zeBTree_Get_node(jdbh, data, root->right);
472 
473  return NULL;
474 }
475 
476 /* ****************************************************************************
477  * *
478  * *
479  **************************************************************************** */
480 int
481 zeBTree_Browse_tree(jdbh, func, root, data)
482  ZEBT_T *jdbh;
483  ZEBT_BROWSE_F func;
484  ZEBTREC_T *root;
485  void *data;
486 {
487  int n = 0;
488 
489  if (jdbh == NULL)
490  return 0;
491 
492  if (root == NULL)
493  return 0;
494 
495  if (jdbh->signature != SIGNATURE)
496  return 0;
497 
498  if (root->left != NULL)
499  n += zeBTree_Browse_tree(jdbh, func, root->left, data);
500 
501  if (func != NULL)
502  n += func(root->data, data);
503 
504  if (root->right != NULL)
505  n += zeBTree_Browse_tree(jdbh, func, root->right, data);
506 
507  return n;
508 }
509 
510 /* ****************************************************************************
511  * *
512  * *
513  **************************************************************************** */
514 bool
515 zeBTree_Cpy(dst, org, getit, arg)
516  ZEBT_T *dst;
517  ZEBT_T *org;
518  ZEBT_SEL_F getit;
519  void *arg;
520 {
521  if (dst == NULL || org == NULL)
522  return FALSE;
523 
524  if (dst->signature != SIGNATURE || org->signature != SIGNATURE)
525  return FALSE;
526 
527  return zeBTree_Cpy_tree(dst, org->root, getit, arg);
528 }
529 
530 /* ****************************************************************************
531  * *
532  * *
533  **************************************************************************** */
534 static bool
535 zeBTree_Cpy_tree(jdbh, root, getit, arg)
536  ZEBT_T *jdbh;
537  ZEBTREC_T *root;
538  ZEBT_SEL_F getit;
539  void *arg;
540 {
541  if (root == NULL)
542  return FALSE;
543 
544  (void) zeBTree_Cpy_tree(jdbh, root->left, getit, arg);
545  if (root->data != NULL)
546  {
547  if (getit(root->data, arg))
548  {
549  if (!zeBTree_Add(jdbh, root->data))
550  ;
551  }
552  } else;
553 
554  (void) zeBTree_Cpy_tree(jdbh, root->right, getit, arg);
555 
556  return TRUE;
557 }
558 
559 /* ****************************************************************************
560  * *
561  * *
562  **************************************************************************** */
563 bool
564 zeBTree_Cleanup(jdbh, getit, arg)
565  ZEBT_T *jdbh;
566  ZEBT_SEL_F getit;
567  void *arg;
568 {
569  ZEBTREC_T *oroot = NULL;
570 
571  if (jdbh == NULL)
572  return FALSE;
573 
574  if (jdbh->signature != SIGNATURE)
575  return FALSE;
576 
577  oroot = jdbh->root;
578  jdbh->root = NULL;
579  jdbh->count = 0;
580 
581  if (zeBTree_Cpy_tree(jdbh, oroot, getit, arg))
582  {
583  zeBTree_Destroy_tree(oroot);
584  }
585 
586  return TRUE;
587 }
588 
589 
590 /* ****************************************************************************
591  * *
592  * *
593  **************************************************************************** */
594 static ZEBTREC_T *
595 zeBTree_Rotate_Left(root)
596  ZEBTREC_T *root;
597 {
598  ZEBTREC_T *tmp;
599 
600  if (root == NULL)
601  return NULL;
602 
603  if (root->right == NULL)
604  return root;
605 
606  tmp = root->right;
607  root->right = tmp->left;
608  tmp->left = root;
609  root = tmp;
610 
611  return root;
612 }
613 
614 /* ****************************************************************************
615  * *
616  * *
617  **************************************************************************** */
618 static ZEBTREC_T *
619 zeBTree_Rotate_Right(root)
620  ZEBTREC_T *root;
621 {
622  ZEBTREC_T *tmp;
623 
624  if (root == NULL)
625  return NULL;
626 
627  if (root->left == NULL)
628  return root;
629 
630  tmp = root->left;
631  root->left = tmp->right;
632  tmp->right = root;
633  root = tmp;
634 
635  return root;
636 }
637 
638 /* ****************************************************************************
639  * *
640  * *
641  **************************************************************************** */
642 static ZEBTREC_T *
643 zeBTree_Right_Balance(root)
644  ZEBTREC_T *root;
645 {
646  ZEBTREC_T *x, *w;
647 
648  x = root->right;
649 
650  switch (x->balance)
651  {
652  case _DB_RH:
653  root->balance = _DB_EH;
654  x->balance = _DB_EH;
655  root = zeBTree_Rotate_Left(root);
656  break;
657  case _DB_EH:
658  ZE_MessageWarning(10, "zeBTree_Right_Balance x->balance == _DB_EH ???");
659  break;
660  case _DB_LH:
661  w = x->left;
662  switch (w->balance)
663  {
664  case _DB_EH:
665  root->balance = _DB_EH;
666  x->balance = _DB_EH;
667  break;
668  case _DB_LH:
669  root->balance = _DB_EH;
670  x->balance = _DB_RH;
671  break;
672  case _DB_RH:
673  root->balance = _DB_LH;
674  x->balance = _DB_EH;
675  break;
676  }
677  w->balance = _DB_EH;
678  x = zeBTree_Rotate_Right(x);
679  root->right = x;
680  root = zeBTree_Rotate_Left(root);
681  break;
682  }
683 
684  return root;
685 }
686 
687 /* ****************************************************************************
688  * *
689  * *
690  **************************************************************************** */
691 static ZEBTREC_T *
692 zeBTree_Left_Balance(root)
693  ZEBTREC_T *root;
694 {
695  ZEBTREC_T *x, *w;
696 
697  x = root->left;
698 
699  switch (x->balance)
700  {
701  case _DB_LH:
702  root->balance = _DB_EH;
703  x->balance = _DB_EH;
704  root = zeBTree_Rotate_Right(root);
705  break;
706  case _DB_EH:
707  ZE_MessageWarning(10, "zeBTree_Left_Balance x->balance == _DB_EH ???");
708  break;
709  case _DB_RH:
710  w = x->right;
711  switch (w->balance)
712  {
713  case _DB_EH:
714  root->balance = _DB_EH;
715  x->balance = _DB_EH;
716  break;
717  case _DB_RH:
718  root->balance = _DB_EH;
719  /* R -> L */
720  x->balance = _DB_LH;
721  break;
722  case _DB_LH:
723  root->balance = _DB_RH;
724  x->balance = _DB_EH;
725  break;
726  }
727  w->balance = _DB_EH;
728  x = zeBTree_Rotate_Left(x);
729  root->left = x;
730  root = zeBTree_Rotate_Right(root);
731  break;
732  }
733 
734  return root;
735 }
736 
737 
738 /* ****************************************************************************
739  * *
740  * *
741  **************************************************************************** */
742 static ZEBTREC_T *
743 zeBTree_Node_Alloc(jdbh, data)
744  ZEBT_T *jdbh;
745  void *data;
746 {
747  ZEBTREC_T *rec;
748 
749  rec = (ZEBTREC_T *) malloc(sizeof (ZEBTREC_T));
750  if (rec == NULL)
751  {
752  ZE_LogSysError("malloc jbtrec");
753  return NULL;
754  }
755 
756  memset(rec, 0, sizeof (ZEBTREC_T));
757 
758  rec->data = malloc(jdbh->size);
759  if (rec->data == NULL)
760  {
761  ZE_LogSysError("malloc data");
762  free(rec);
763  return NULL;
764  }
765  rec->left = NULL;
766  rec->right = NULL;
767  rec->balance = _DB_EH;
768 
769  memcpy(rec->data, data, jdbh->size);
770  return rec;
771 }
772 
773 /* ****************************************************************************
774  * *
775  * *
776  **************************************************************************** */
777 static bool
778 zeBTree_Add_node(jdbh, data, root, taller)
779  ZEBT_T *jdbh;
780  void *data;
781  ZEBTREC_T **root;
782  bool *taller;
783 {
784  if (root == NULL)
785  return FALSE;
786 
787  if (*root == NULL)
788  {
789  ZEBTREC_T *node = NULL;
790 
791  ZE_MessageInfo(19, "Empty tree ...");
792  node = zeBTree_Node_Alloc(jdbh, data);
793  if (node != NULL)
794  {
795  if (taller != NULL)
796  *taller = TRUE;
797  node->balance = _DB_EH;
798  jdbh->count++;
799  *root = node;
800  }
801  return (node != NULL);;
802  }
803 
804  {
805  int r;
806  ZEBTREC_T *troot = NULL;
807 
808  bool ok = TRUE;
809 
810  troot = *root;
811 
812  r = (*jdbh->reccmp) (data, troot->data);
813 
814  if (r == 0)
815  {
816  ZE_LogMsgNotice(0, "Node already on the tree...");
817  return FALSE;
818  }
819 
820  if (r < 0)
821  {
822  ok = zeBTree_Add_node(jdbh, data, &(troot->left), taller);
823 
824  if (ok && (taller != NULL) && *taller)
825  {
826  switch (troot->balance)
827  {
828  case _DB_LH:
829  {
830  ZEBTREC_T *node = NULL;
831 
832  node = zeBTree_Left_Balance(troot);
833  *taller = FALSE;
834  if (node == NULL)
835  {
836  ZE_LogMsgWarning(0, "zeBTree_Left_Balance returned NULL...");
837  return FALSE;
838  }
839  troot = node;
840  }
841  break;
842  case _DB_EH:
843  troot->balance = _DB_LH;
844  *taller = TRUE;
845  break;
846  case _DB_RH:
847  troot->balance = _DB_EH;
848  *taller = FALSE;
849  break;
850  default:
851  /* error */
852  break;
853  }
854  }
855  *root = troot;
856  return ok;
857  }
858 
859  if (r > 0)
860  {
861  ok = zeBTree_Add_node(jdbh, data, &(troot->right), taller);
862 
863  if (ok && (taller != NULL) && *taller)
864  {
865  switch (troot->balance)
866  {
867  case _DB_LH:
868  troot->balance = _DB_EH;
869  *taller = FALSE;
870  break;
871  case _DB_EH:
872  troot->balance = _DB_RH;
873  *taller = TRUE;
874  break;
875  case _DB_RH:
876  {
877  ZEBTREC_T *node = NULL;
878 
879  node = zeBTree_Right_Balance(troot);
880  *taller = FALSE;
881  if (node == NULL)
882  {
883  ZE_LogMsgWarning(0, "zeBTree_Right_Balance returned NULL...");
884  return FALSE;
885  }
886  troot = node;
887  }
888  break;
889  default:
890  /* error */
891  break;
892  }
893 
894  }
895  *root = troot;
896  return ok;
897  }
898  }
899 
900  return TRUE;
901 }
902 
903 /* ****************************************************************************
904  * *
905  * *
906  **************************************************************************** */
907 static int
908 jlog2(x)
909  int x;
910 {
911  int n = 0;
912 
913  for (x /= 2; x != 0; x /= 2)
914  n++;
915 
916  return n;
917 }
918 
919 int
921  ZEBT_T *jdbh;
922 {
923 
924  if (jdbh == NULL)
925  return FALSE;
926 
927  if (jdbh->signature != SIGNATURE)
928  return FALSE;
929 
930  return 2 * jlog2(jdbh->count);
931 }
bool zeBTree_Set_BTree_Size(ZEBT_T *jdbh, bool chkCount, int maxCount)
Definition: zeBTree.c:170
bool zeBTree_Del(ZEBT_T *jdbh, void *data)
Definition: zeBTree.c:356
uint32_t signature
Definition: zeBTree.h:74
int count
Definition: zeBTree.h:75
void * zeBTree_Get(ZEBT_T *jdbh, void *data)
Definition: zeBTree.c:281
ZEBTREC_T * left
Definition: zeBTree.c:42
#define FREE(x)
Definition: macros.h:37
bool zeBTree_Init(ZEBT_T *jdbh, size_t size, ZEBT_CMP_F reccmp)
Definition: zeBTree.c:96
#define MUTEX_UNLOCK(mutex)
Definition: macros.h:101
#define _DB_LH
Definition: zeBTree.c:36
bool ok
Definition: ze-connopen.c:59
#define MUTEX_LOCK(mutex)
Definition: macros.h:93
bool chkCount
Definition: zeBTree.h:79
bool zeBTree_Add(ZEBT_T *jdbh, void *data)
Definition: zeBTree.c:309
#define FALSE
Definition: macros.h:160
#define ZE_LogMsgError(level,...)
Definition: zeSyslog.h:113
ZEBTREC_T * right
Definition: zeBTree.c:43
#define _DB_RH
Definition: zeBTree.c:38
bool zeBTree_Destroy(ZEBT_T *jdbh)
Definition: zeBTree.c:192
#define ZE_LogMsgNotice(level,...)
Definition: zeSyslog.h:111
int zeBTree_Max_Height(ZEBT_T *)
Definition: zeBTree.c:920
int balance
Definition: zeBTree.c:44
pthread_mutex_t mutex
Definition: zeBTree.h:82
int zeBTree_Count(ZEBT_T *jdbh)
Definition: zeBTree.c:245
bool zeBTree_Clear(ZEBT_T *jdbh)
Definition: zeBTree.c:222
bool zeBTree_Cpy(ZEBT_T *dst, ZEBT_T *org, ZEBT_SEL_F getit, void *arg)
Definition: zeBTree.c:515
#define ZE_MessageInfo(level,...)
Definition: zeSyslog.h:90
int(* ZEBT_BROWSE_F)(void *, void *)
Definition: zeBTree.h:37
#define TRUE
Definition: macros.h:157
#define ZE_MessageWarning(level,...)
Definition: zeSyslog.h:92
#define memcpy(d, s, n)
Definition: ze-sys.h:224
#define ZE_LogSysError(...)
Definition: zeSyslog.h:129
#define _DB_EH
Definition: zeBTree.c:37
#define MAX_BTNODES
Definition: zeBTree.h:66
void * data
Definition: zeBTree.c:45
#define ZE_LogMsgWarning(level,...)
Definition: zeSyslog.h:112
ZEBT_CMP_F reccmp
Definition: zeBTree.h:78
bool(* ZEBT_SEL_F)(void *, void *)
Definition: zeBTree.h:36
size_t size
Definition: zeBTree.h:76
int(* ZEBT_CMP_F)(void *, void *)
Definition: zeBTree.h:35
bool zeBTree_unLock(ZEBT_T *jdbh)
Definition: zeBTree.c:151
int maxCount
Definition: zeBTree.h:80
int nbErr
Definition: zeBTree.h:81
#define SIGNATURE
Definition: ze-libjc.h:75
bool zeBTree_Lock(ZEBT_T *jdbh)
Definition: zeBTree.c:131
#define MAX_BTERR
Definition: zeBTree.c:306
bool zeBTree_Cleanup(ZEBT_T *jdbh, ZEBT_SEL_F getit, void *arg)
Definition: zeBTree.c:564
int zeBTree_Browse(ZEBT_T *jdbh, ZEBT_BROWSE_F func, void *data)
Definition: zeBTree.c:262
ZEBTREC_T * root
Definition: zeBTree.h:77
Definition: zeBTree.h:73