~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mf_keycaches.c

  • Committer: Monty Taylor
  • Date: 2008-07-16 19:10:24 UTC
  • mfrom: (51.1.127 remove-dbug)
  • mto: This revision was merged to the branch mainline in revision 176.
  • Revision ID: monty@inaugust.com-20080716191024-prjgoh7fbri7rx26
MergedĀ fromĀ remove-dbug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
 
71
71
static void safe_hash_entry_free(SAFE_HASH_ENTRY *entry)
72
72
{
73
 
  DBUG_ENTER("free_assign_entry");
74
73
  my_free((uchar*) entry, MYF(0));
75
 
  DBUG_VOID_RETURN;
 
74
  return;
76
75
}
77
76
 
78
77
 
107
106
static my_bool safe_hash_init(SAFE_HASH *hash, uint elements,
108
107
                              uchar *default_value)
109
108
{
110
 
  DBUG_ENTER("safe_hash");
111
109
  if (hash_init(&hash->hash, &my_charset_bin, elements,
112
110
                0, 0, (hash_get_key) safe_hash_entry_get,
113
111
                (void (*)(void*)) safe_hash_entry_free, 0))
114
112
  {
115
113
    hash->default_value= 0;
116
 
    DBUG_RETURN(1);
 
114
    return(1);
117
115
  }
118
116
  my_rwlock_init(&hash->mutex, 0);
119
117
  hash->default_value= default_value;
120
118
  hash->root= 0;
121
 
  DBUG_RETURN(0);
 
119
  return(0);
122
120
}
123
121
 
124
122
 
150
148
static uchar *safe_hash_search(SAFE_HASH *hash, const uchar *key, uint length)
151
149
{
152
150
  uchar *result;
153
 
  DBUG_ENTER("safe_hash_search");
154
151
  rw_rdlock(&hash->mutex);
155
152
  result= hash_search(&hash->hash, key, length);
156
153
  rw_unlock(&hash->mutex);
158
155
    result= hash->default_value;
159
156
  else
160
157
    result= ((SAFE_HASH_ENTRY*) result)->data;
161
 
  DBUG_PRINT("exit",("data: 0x%lx", (long) result));
162
 
  DBUG_RETURN(result);
 
158
  return(result);
163
159
}
164
160
 
165
161
 
188
184
{
189
185
  SAFE_HASH_ENTRY *entry;
190
186
  my_bool error= 0;
191
 
  DBUG_ENTER("safe_hash_set");
192
 
  DBUG_PRINT("enter",("key: %.*s  data: 0x%lx", length, key, (long) data));
193
187
 
194
188
  rw_wrlock(&hash->mutex);
195
189
  entry= (SAFE_HASH_ENTRY*) hash_search(&hash->hash, key, length);
242
236
 
243
237
end:
244
238
  rw_unlock(&hash->mutex);
245
 
  DBUG_RETURN(error);
 
239
  return(error);
246
240
}
247
241
 
248
242
 
264
258
static void safe_hash_change(SAFE_HASH *hash, uchar *old_data, uchar *new_data)
265
259
{
266
260
  SAFE_HASH_ENTRY *entry, *next;
267
 
  DBUG_ENTER("safe_hash_set");
268
261
 
269
262
  rw_wrlock(&hash->mutex);
270
263
 
285
278
  }
286
279
 
287
280
  rw_unlock(&hash->mutex);
288
 
  DBUG_VOID_RETURN;
 
281
  return;
289
282
}
290
283
 
291
284