~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/ut/ut0mem.cc

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (C) 1994, 2009, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
180
180
 
181
181
                /* Make an intentional seg fault so that we get a stack
182
182
                trace */
183
 
                /* Intentional segfault on NetWare causes an abend. Avoid this
184
 
                by graceful exit handling in ut_a(). */
185
 
#if (!defined __NETWARE__)
186
183
                if (assert_on_error) {
187
184
                        ut_print_timestamp(stderr);
188
185
 
195
192
                } else {
196
193
                        return(NULL);
197
194
                }
198
 
#else
199
 
                ut_a(0);
200
 
#endif
201
195
        }
202
196
 
203
197
        if (set_to_zero) {
235
229
Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is
236
230
defined.
237
231
@return own: allocated memory */
 
232
extern "C"
238
233
UNIV_INTERN
239
234
void*
240
235
ut_malloc(
291
286
#endif /* !UNIV_HOTBACKUP */
292
287
 
293
288
/**********************************************************************//**
294
 
Frees a memory block allocated with ut_malloc. */
 
289
Frees a memory block allocated with ut_malloc. Freeing a NULL pointer is
 
290
a nop. */
 
291
extern "C"
295
292
UNIV_INTERN
296
293
void
297
294
ut_free(
298
295
/*====*/
299
 
        void* ptr)  /*!< in, own: memory block */
 
296
        void* ptr)  /*!< in, own: memory block, can be NULL */
300
297
{
301
298
#ifndef UNIV_HOTBACKUP
302
299
        ut_mem_block_t* block;
303
300
 
304
 
        if (UNIV_LIKELY(srv_use_sys_malloc)) {
 
301
        if (ptr == NULL) {
 
302
                return;
 
303
        } else if (UNIV_LIKELY(srv_use_sys_malloc)) {
305
304
                free(ptr);
306
305
                return;
307
306
        }
350
349
       original  block  is  left  untouched  - it is not freed or
351
350
       moved.
352
351
@return own: pointer to new mem block or NULL */
 
352
extern "C"
353
353
UNIV_INTERN
354
354
void*
355
355
ut_realloc(
598
598
                count = ut_strcount(str, s1);
599
599
        }
600
600
 
601
 
        new_str = mem_alloc(str_len + count * len_delta + 1);
 
601
        new_str = static_cast<char *>(mem_alloc(str_len + count * len_delta + 1));
602
602
        ptr = new_str;
603
603
 
604
604
        while (str) {