src/nrbtab.c File Reference

#include "copyright.h"
#include "config.h"
#include "db.h"
#include "externs.h"
#include "htab.h"
#include "alloc.h"
#include "mudconf.h"

Include dependency graph for nrbtab.c:

Go to the source code of this file.

Functions

static int nhrbtab_compare (int left, int right, void *arg)
void nhashinit (RBTAB *htab, int size)
void nhashreset (RBTAB *htab)
void * nhashfind (int val, RBTAB *htab)
int nhashadd (int val, void *hashdata, RBTAB *htab)
void nhashdelete (int val, RBTAB *htab)
void nhashflush (RBTAB *htab, int size)
int nhashrepl (int val, void *hashdata, RBTAB *htab)


Function Documentation

int nhashadd ( int  val,
void *  hashdata,
RBTAB htab 
)

Definition at line 49 of file nrbtab.c.

References rb_exists(), rb_insert(), and rbtable::tree.

Referenced by atr_match1(), find_wild_attrs(), fwdlist_set(), load_mail(), look_atrs1(), and send_mail().

00050 {
00051         if(rb_exists(htab->tree, (void *) val))
00052                 return (-1);
00053         rb_insert(htab->tree, (void *) val, hashdata);
00054         return 0;
00055 
00056 }

void nhashdelete ( int  val,
RBTAB htab 
)

Definition at line 63 of file nrbtab.c.

References rb_delete(), and rbtable::tree.

Referenced by do_mail_purge(), and fwdlist_clr().

00064 {
00065         rb_delete(htab->tree, (void *) val);
00066         return;
00067 }

void* nhashfind ( int  val,
RBTAB htab 
)

Definition at line 38 of file nrbtab.c.

References rbtable::checks, rb_find(), and rbtable::tree.

Referenced by atr_match1(), count_mail(), do_mail_file(), do_mail_flags(), do_mail_list(), do_mail_purge(), do_mail_read(), do_mail_retract(), do_mail_review(), dump_mail(), find_wild_attrs(), fwdlist_get(), load_mail(), look_atrs1(), mail_fetch(), send_mail(), and urgent_mail().

00039 {
00040         htab->checks++;
00041         return rb_find(htab->tree, (void *) val);
00042 }

void nhashflush ( RBTAB htab,
int  size 
)

Definition at line 74 of file nrbtab.c.

References rbtable::last, nhrbtab_compare(), rb_destroy(), rb_init(), and rbtable::tree.

Referenced by atr_match(), look_atrs(), and parse_attrib_wild().

00075 {
00076         rb_destroy(htab->tree);
00077         htab->tree = rb_init((void *)nhrbtab_compare, NULL);
00078         htab->last = NULL;
00079 }

void nhashinit ( RBTAB htab,
int  size 
)

Definition at line 18 of file nrbtab.c.

References rbtable::last, nhrbtab_compare(), rb_init(), and rbtable::tree.

Referenced by main().

00019 {
00020         memset(htab, 0, sizeof(RBTAB));
00021         htab->tree = rb_init((void *) nhrbtab_compare, NULL);
00022         htab->last = NULL;
00023 }

int nhashrepl ( int  val,
void *  hashdata,
RBTAB htab 
)

Definition at line 86 of file nrbtab.c.

References rb_insert(), and rbtable::tree.

Referenced by check_mail_expiration(), do_mail_debug(), do_mail_purge(), do_mail_retract(), and fwdlist_set().

00087 {
00088         struct int_dict_entry *ent;
00089 
00090         rb_insert(htab->tree, (void *) val, hashdata);
00091     return 1;
00092 }

void nhashreset ( RBTAB htab  ) 

Definition at line 25 of file nrbtab.c.

References rbtable::checks, rbtable::hits, and rbtable::scans.

Referenced by main().

00026 {
00027         htab->checks = 0;
00028         htab->scans = 0;
00029         htab->hits = 0;
00030 };

static int nhrbtab_compare ( int  left,
int  right,
void *  arg 
) [static]

Definition at line 13 of file nrbtab.c.

Referenced by nhashflush(), and nhashinit().

00014 {
00015         return (right - left);
00016 }


Generated on Mon May 28 04:25:46 2007 for BattletechMUX by  doxygen 1.4.7