~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/hash.h

  • Committer: Andy Lester
  • Date: 2008-08-09 05:13:22 UTC
  • mto: (266.1.29 use-replace-funcs)
  • mto: This revision was merged to the branch mainline in revision 287.
  • Revision ID: andy@petdance.com-20080809051322-dzas70no2mv6c9i5
removed incorrect comment

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
/* flags for hash_init */
31
31
#define HASH_UNIQUE     1       /* hash_insert fails on duplicate key */
32
32
 
33
 
typedef unsigned char *(*hash_get_key)(const unsigned char *,size_t*,bool);
 
33
typedef uchar *(*hash_get_key)(const uchar *,size_t*,bool);
34
34
typedef void (*hash_free_key)(void *);
35
35
 
36
36
typedef struct st_hash {
37
37
  size_t key_offset,key_length;         /* Length of key if const length */
38
38
  size_t blength;
39
 
  uint32_t records;
40
 
  uint32_t flags;
 
39
  ulong records;
 
40
  uint flags;
41
41
  DYNAMIC_ARRAY array;                          /* Place for hash_keys */
42
42
  hash_get_key get_key;
43
43
  void (*free)(void *);
45
45
} HASH;
46
46
 
47
47
/* A search iterator state */
48
 
typedef uint32_t HASH_SEARCH_STATE;
 
48
typedef uint HASH_SEARCH_STATE;
49
49
 
50
50
#define hash_init(A,B,C,D,E,F,G,H) _hash_init(A,0,B,C,D,E,F,G,H CALLER_INFO)
51
51
#define hash_init2(A,B,C,D,E,F,G,H,I) _hash_init(A,B,C,D,E,F,G,H,I CALLER_INFO)
52
 
bool _hash_init(HASH *hash, uint32_t growth_size, const CHARSET_INFO * const charset,
53
 
                   uint32_t default_array_elements, size_t key_offset,
 
52
bool _hash_init(HASH *hash, uint growth_size, const CHARSET_INFO * const charset,
 
53
                   ulong default_array_elements, size_t key_offset,
54
54
                   size_t key_length, hash_get_key get_key,
55
 
                   void (*free_element)(void*), uint32_t flags CALLER_INFO_PROTO);
 
55
                   void (*free_element)(void*), uint flags CALLER_INFO_PROTO);
56
56
void hash_free(HASH *tree);
57
57
void my_hash_reset(HASH *hash);
58
 
unsigned char *hash_element(HASH *hash,uint32_t idx);
59
 
unsigned char *hash_search(const HASH *info, const unsigned char *key, size_t length);
60
 
unsigned char *hash_first(const HASH *info, const unsigned char *key, size_t length,
 
58
uchar *hash_element(HASH *hash,ulong idx);
 
59
uchar *hash_search(const HASH *info, const uchar *key, size_t length);
 
60
uchar *hash_first(const HASH *info, const uchar *key, size_t length,
61
61
                HASH_SEARCH_STATE *state);
62
 
unsigned char *hash_next(const HASH *info, const unsigned char *key, size_t length,
 
62
uchar *hash_next(const HASH *info, const uchar *key, size_t length,
63
63
                 HASH_SEARCH_STATE *state);
64
 
bool my_hash_insert(HASH *info,const unsigned char *data);
65
 
bool hash_delete(HASH *hash,unsigned char *record);
66
 
bool hash_update(HASH *hash,unsigned char *record,unsigned char *old_key,size_t old_key_length);
67
 
void hash_replace(HASH *hash, HASH_SEARCH_STATE *state, unsigned char *new_row);
 
64
bool my_hash_insert(HASH *info,const uchar *data);
 
65
bool hash_delete(HASH *hash,uchar *record);
 
66
bool hash_update(HASH *hash,uchar *record,uchar *old_key,size_t old_key_length);
 
67
void hash_replace(HASH *hash, HASH_SEARCH_STATE *state, uchar *new_row);
68
68
 
69
69
#define hash_clear(H) memset((H), 0, sizeof(*(H)))
70
70
#define hash_inited(H) ((H)->array.buffer != 0)