~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_close.c

Deleted files from strings that are not used. 

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
    }
 
93
#ifdef THREAD
87
94
    thr_lock_delete(&share->lock);
88
 
    pthread_mutex_destroy(&share->intern_lock);
 
95
    VOID(pthread_mutex_destroy(&share->intern_lock));
89
96
    {
90
97
      int i,keys;
91
98
      keys = share->state.header.keys;
92
 
      rwlock_destroy(&share->mmap_lock);
 
99
      VOID(rwlock_destroy(&share->mmap_lock));
93
100
      for(i=0; i<keys; i++) {
94
 
        rwlock_destroy(&share->key_root_lock[i]);
 
101
        VOID(rwlock_destroy(&share->key_root_lock[i]));
95
102
      }
96
103
    }
97
 
    free((unsigned char*) info->s);
 
104
#endif
 
105
    my_free((uchar*) info->s,MYF(0));
98
106
  }
99
107
  pthread_mutex_unlock(&THR_LOCK_myisam);
100
 
 
 
108
  if (info->ftparser_param)
 
109
  {
 
110
    my_free((uchar*)info->ftparser_param, MYF(0));
 
111
    info->ftparser_param= 0;
 
112
  }
101
113
  if (info->dfile >= 0 && my_close(info->dfile,MYF(0)))
102
114
    error = my_errno;
103
115
 
104
 
  free((unsigned char*) info);
 
116
  myisam_log_command(MI_LOG_CLOSE,info,NULL,0,error);
 
117
  my_free((uchar*) info,MYF(0));
105
118
 
106
119
  if (error)
107
120
  {
108
 
    return(my_errno=error);
 
121
    DBUG_RETURN(my_errno=error);
109
122
  }
110
 
  return(0);
 
123
  DBUG_RETURN(0);
111
124
} /* mi_close */