~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/completion_hash.cc

Removed/replaced DBUG symbols and standardized TRUE/FALSE

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *
18
18
 * by  Andi Gutmans <andi@zend.com>
19
19
 * and Zeev Suraski <zeev@zend.com>
20
 
 * Small portability changes by Monty.
 
20
 * Small portability changes by Monty. Changed also to use my_malloc/my_free
21
21
 */
22
22
 
23
 
#include "client_priv.h"
24
 
#include <mystrings/m_string.h>
 
23
#include <my_global.h>
 
24
#include <m_string.h>
 
25
#undef SAFEMALLOC                               // Speed things up
 
26
#include <my_sys.h>
25
27
#include "completion_hash.h"
26
28
 
27
29
uint hashpjw(const char *arKey, uint nKeyLength)
40
42
 
41
43
int completion_hash_init(HashTable *ht, uint nSize)
42
44
{
43
 
  ht->arBuckets = (Bucket **) malloc(nSize* sizeof(Bucket *));
44
 
  memset(ht->arBuckets, 0, nSize* sizeof(Bucket *));
 
45
  ht->arBuckets = (Bucket **) my_malloc(nSize* sizeof(Bucket *),
 
46
                                        MYF(MY_ZEROFILL | MY_WME));
45
47
 
46
48
  if (!ht->arBuckets)
47
49
  {
204
206
void completion_hash_clean(HashTable *ht)
205
207
{
206
208
  free_root(&ht->mem_root,MYF(0));
207
 
  memset(ht->arBuckets, 0, ht->nTableSize*sizeof(Bucket *));
 
209
  bzero((char*) ht->arBuckets,ht->nTableSize*sizeof(Bucket *));
208
210
}
209
211
 
210
212
 
211
213
void completion_hash_free(HashTable *ht)
212
214
{
213
215
  completion_hash_clean(ht);
214
 
  free(ht->arBuckets);
 
216
  my_free(ht->arBuckets, MYF(0));
215
217
}
216
218
 
217
219