~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: lbieber
  • Date: 2010-10-02 19:48:35 UTC
  • mfrom: (1730.6.19 drizzle-make-lcov)
  • Revision ID: lbieber@orisndriz08-20101002194835-q5zd9qc4lvx1xnfo
Merge Hartmut - clean up lex, now require flex to build, also "make lcov" improvements

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
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
13
13
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
 
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
15
Place, Suite 330, Boston, MA 02111-1307 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
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__)
183
186
                if (assert_on_error) {
184
187
                        ut_print_timestamp(stderr);
185
188
 
192
195
                } else {
193
196
                        return(NULL);
194
197
                }
 
198
#else
 
199
                ut_a(0);
 
200
#endif
195
201
        }
196
202
 
197
203
        if (set_to_zero) {
229
235
Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is
230
236
defined.
231
237
@return own: allocated memory */
232
 
extern "C"
233
238
UNIV_INTERN
234
239
void*
235
240
ut_malloc(
286
291
#endif /* !UNIV_HOTBACKUP */
287
292
 
288
293
/**********************************************************************//**
289
 
Frees a memory block allocated with ut_malloc. Freeing a NULL pointer is
290
 
a nop. */
291
 
extern "C"
 
294
Frees a memory block allocated with ut_malloc. */
292
295
UNIV_INTERN
293
296
void
294
297
ut_free(
295
298
/*====*/
296
 
        void* ptr)  /*!< in, own: memory block, can be NULL */
 
299
        void* ptr)  /*!< in, own: memory block */
297
300
{
298
301
#ifndef UNIV_HOTBACKUP
299
302
        ut_mem_block_t* block;
300
303
 
301
 
        if (ptr == NULL) {
302
 
                return;
303
 
        } else if (UNIV_LIKELY(srv_use_sys_malloc)) {
 
304
        if (UNIV_LIKELY(srv_use_sys_malloc)) {
304
305
                free(ptr);
305
306
                return;
306
307
        }
349
350
       original  block  is  left  untouched  - it is not freed or
350
351
       moved.
351
352
@return own: pointer to new mem block or NULL */
352
 
extern "C"
353
353
UNIV_INTERN
354
354
void*
355
355
ut_realloc(
434
434
                        " total allocated memory is %lu\n",
435
435
                        (ulong) ut_total_allocated_memory);
436
436
        }
437
 
 
438
 
        ut_mem_block_list_inited = FALSE;
439
437
}
440
438
#endif /* !UNIV_HOTBACKUP */
441
439
 
598
596
                count = ut_strcount(str, s1);
599
597
        }
600
598
 
601
 
        new_str = static_cast<char *>(mem_alloc(str_len + count * len_delta + 1));
 
599
        new_str = mem_alloc(str_len + count * len_delta + 1);
602
600
        ptr = new_str;
603
601
 
604
602
        while (str) {