~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_close.c

Removed/replaced DBUG symbols and standardized TRUE/FALSE

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
{
27
27
  int error=0,flag;
28
28
  MYISAM_SHARE *share=info->s;
 
29
  DBUG_ENTER("mi_close");
 
30
  DBUG_PRINT("enter",("base: 0x%lx  reopen: %u  locks: %u",
 
31
                      (long) info, (uint) share->reopen,
 
32
                      (uint) share->tot_locks));
29
33
 
30
34
  pthread_mutex_lock(&THR_LOCK_myisam);
31
35
  if (info->lock_type == F_EXTRA_LCK)
56
60
  myisam_open_list=list_delete(myisam_open_list,&info->open_list);
57
61
  pthread_mutex_unlock(&share->intern_lock);
58
62
 
59
 
  void * rec_buff_ptr= mi_get_rec_buff_ptr(info, info->rec_buff);
60
 
  if (rec_buff_ptr != NULL)
61
 
    free(rec_buff_ptr);
 
63
  my_free(mi_get_rec_buff_ptr(info, info->rec_buff), MYF(MY_ALLOW_ZERO_PTR));
62
64
  if (flag)
63
65
  {
64
66
    if (share->kfile >= 0 &&
79
81
      if (my_close(share->kfile,MYF(0)))
80
82
        error = my_errno;
81
83
    }
 
84
#ifdef HAVE_MMAP
 
85
    if (share->file_map)
 
86
      _mi_unmap_file(info);
 
87
#endif
82
88
    if (share->decode_trees)
83
89
    {
84
 
      free((unsigned char*) share->decode_trees);
85
 
      free((unsigned char*) share->decode_tables);
 
90
      my_free((uchar*) share->decode_trees,MYF(0));
 
91
      my_free((uchar*) share->decode_tables,MYF(0));
86
92
    }
87
93
    thr_lock_delete(&share->lock);
88
 
    pthread_mutex_destroy(&share->intern_lock);
 
94
    VOID(pthread_mutex_destroy(&share->intern_lock));
89
95
    {
90
96
      int i,keys;
91
97
      keys = share->state.header.keys;
92
 
      rwlock_destroy(&share->mmap_lock);
 
98
      VOID(rwlock_destroy(&share->mmap_lock));
93
99
      for(i=0; i<keys; i++) {
94
 
        rwlock_destroy(&share->key_root_lock[i]);
 
100
        VOID(rwlock_destroy(&share->key_root_lock[i]));
95
101
      }
96
102
    }
97
 
    free((unsigned char*) info->s);
 
103
    my_free((uchar*) info->s,MYF(0));
98
104
  }
99
105
  pthread_mutex_unlock(&THR_LOCK_myisam);
100
106
 
101
107
  if (info->dfile >= 0 && my_close(info->dfile,MYF(0)))
102
108
    error = my_errno;
103
109
 
104
 
  free((unsigned char*) info);
 
110
  myisam_log_command(MI_LOG_CLOSE,info,NULL,0,error);
 
111
  my_free((uchar*) info,MYF(0));
105
112
 
106
113
  if (error)
107
114
  {
108
 
    return(my_errno=error);
 
115
    DBUG_RETURN(my_errno=error);
109
116
  }
110
 
  return(0);
 
117
  DBUG_RETURN(0);
111
118
} /* mi_close */