@@ -32,10 +32,6 @@ static const char mysqlnd_erealloc_name[] = "_mysqlnd_erealloc";
32
32
static const char mysqlnd_perealloc_name [] = "_mysqlnd_perealloc" ;
33
33
static const char mysqlnd_efree_name [] = "_mysqlnd_efree" ;
34
34
static const char mysqlnd_pefree_name [] = "_mysqlnd_pefree" ;
35
- static const char mysqlnd_malloc_name [] = "_mysqlnd_malloc" ;
36
- static const char mysqlnd_calloc_name [] = "_mysqlnd_calloc" ;
37
- static const char mysqlnd_realloc_name [] = "_mysqlnd_realloc" ;
38
- static const char mysqlnd_free_name [] = "_mysqlnd_free" ;
39
35
static const char mysqlnd_pememdup_name [] = "_mysqlnd_pememdup" ;
40
36
static const char mysqlnd_pestrndup_name [] = "_mysqlnd_pestrndup" ;
41
37
static const char mysqlnd_pestrdup_name [] = "_mysqlnd_pestrdup" ;
@@ -50,10 +46,6 @@ PHPAPI const char * mysqlnd_debug_std_no_trace_funcs[] =
50
46
mysqlnd_pecalloc_name ,
51
47
mysqlnd_pefree_name ,
52
48
mysqlnd_perealloc_name ,
53
- mysqlnd_malloc_name ,
54
- mysqlnd_calloc_name ,
55
- mysqlnd_realloc_name ,
56
- mysqlnd_free_name ,
57
49
mysqlnd_pestrndup_name ,
58
50
mysqlnd_read_header_name ,
59
51
mysqlnd_read_body_name ,
@@ -262,147 +254,6 @@ static void _mysqlnd_pefree(void *ptr, zend_bool persistent MYSQLND_MEM_D)
262
254
/* }}} */
263
255
264
256
265
- /* {{{ _mysqlnd_malloc */
266
- static void * _mysqlnd_malloc (size_t size MYSQLND_MEM_D )
267
- {
268
- void * ret ;
269
- zend_bool collect_memory_statistics = MYSQLND_G (collect_memory_statistics );
270
- #if PHP_DEBUG
271
- zend_long * threshold = & MYSQLND_G (debug_malloc_fail_threshold );
272
- TRACE_ALLOC_ENTER (mysqlnd_malloc_name );
273
-
274
- {
275
- char * fn = strrchr (__zend_filename , PHP_DIR_SEPARATOR );
276
- TRACE_ALLOC_INF_FMT ("file=%-15s line=%4d" , fn ? fn + 1 :__zend_filename , __zend_lineno );
277
- }
278
-
279
- if (* threshold == 0 ) {
280
- ret = NULL ;
281
- } else {
282
- ret = malloc (REAL_SIZE (size ));
283
- -- * threshold ;
284
- }
285
- #else
286
- TRACE_ALLOC_ENTER (mysqlnd_malloc_name );
287
- ret = malloc (REAL_SIZE (size ));
288
- #endif
289
-
290
- TRACE_ALLOC_INF_FMT ("size=%lu ptr=%p" , size , ret );
291
- if (ret && collect_memory_statistics ) {
292
- * (size_t * ) ret = size ;
293
- MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2 (STAT_MEM_MALLOC_COUNT , 1 , STAT_MEM_MALLOC_AMOUNT , size );
294
- }
295
- TRACE_ALLOC_RETURN (FAKE_PTR (ret ));
296
- }
297
- /* }}} */
298
-
299
-
300
- /* {{{ _mysqlnd_calloc */
301
- static void * _mysqlnd_calloc (unsigned int nmemb , size_t size MYSQLND_MEM_D )
302
- {
303
- void * ret ;
304
- zend_bool collect_memory_statistics = MYSQLND_G (collect_memory_statistics );
305
- #if PHP_DEBUG
306
- zend_long * threshold = & MYSQLND_G (debug_calloc_fail_threshold );
307
- TRACE_ALLOC_ENTER (mysqlnd_calloc_name );
308
-
309
- {
310
- char * fn = strrchr (__zend_filename , PHP_DIR_SEPARATOR );
311
- TRACE_ALLOC_INF_FMT ("file=%-15s line=%4d" , fn ? fn + 1 :__zend_filename , __zend_lineno );
312
- }
313
-
314
- if (* threshold == 0 ) {
315
- ret = NULL ;
316
- } else {
317
- ret = calloc (nmemb , REAL_SIZE (size ));
318
- -- * threshold ;
319
- }
320
- #else
321
- TRACE_ALLOC_ENTER (mysqlnd_calloc_name );
322
- ret = calloc (nmemb , REAL_SIZE (size ));
323
- #endif
324
-
325
- TRACE_ALLOC_INF_FMT ("size=%lu ptr=%p" , size , ret );
326
- if (ret && collect_memory_statistics ) {
327
- * (size_t * ) ret = size ;
328
- MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2 (STAT_MEM_CALLOC_COUNT , 1 , STAT_MEM_CALLOC_AMOUNT , size );
329
- }
330
- TRACE_ALLOC_RETURN (FAKE_PTR (ret ));
331
- }
332
- /* }}} */
333
-
334
-
335
- /* {{{ _mysqlnd_realloc */
336
- static void * _mysqlnd_realloc (void * ptr , size_t new_size MYSQLND_MEM_D )
337
- {
338
- void * ret ;
339
- zend_bool collect_memory_statistics = MYSQLND_G (collect_memory_statistics );
340
- #if PHP_DEBUG
341
- zend_long * threshold = & MYSQLND_G (debug_realloc_fail_threshold );
342
- TRACE_ALLOC_ENTER (mysqlnd_realloc_name );
343
-
344
- {
345
- char * fn = strrchr (__zend_filename , PHP_DIR_SEPARATOR );
346
- TRACE_ALLOC_INF_FMT ("file=%-15s line=%4d" , fn ? fn + 1 :__zend_filename , __zend_lineno );
347
- }
348
- TRACE_ALLOC_INF_FMT ("ptr=%p new_size=%lu " , new_size , ptr );
349
- TRACE_ALLOC_INF_FMT ("before: %lu" , zend_memory_usage (TRUE));
350
-
351
- if (* threshold == 0 ) {
352
- ret = NULL ;
353
- } else {
354
- ret = realloc (REAL_PTR (ptr ), REAL_SIZE (new_size ));
355
- -- * threshold ;
356
- }
357
- #else
358
- TRACE_ALLOC_ENTER (mysqlnd_realloc_name );
359
- TRACE_ALLOC_INF_FMT ("ptr=%p new_size=%lu " , new_size , ptr );
360
- TRACE_ALLOC_INF_FMT ("before: %lu" , zend_memory_usage (TRUE));
361
- ret = realloc (REAL_PTR (ptr ), REAL_SIZE (new_size ));
362
- #endif
363
-
364
- TRACE_ALLOC_INF_FMT ("new_ptr=%p" , (char * )ret );
365
-
366
- if (ret && collect_memory_statistics ) {
367
- * (size_t * ) ret = new_size ;
368
- MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2 (STAT_MEM_REALLOC_COUNT , 1 , STAT_MEM_REALLOC_AMOUNT , new_size );
369
- }
370
- TRACE_ALLOC_RETURN (FAKE_PTR (ret ));
371
- }
372
- /* }}} */
373
-
374
-
375
- /* {{{ _mysqlnd_free */
376
- static void _mysqlnd_free (void * ptr MYSQLND_MEM_D )
377
- {
378
- size_t free_amount = 0 ;
379
- zend_bool collect_memory_statistics = MYSQLND_G (collect_memory_statistics );
380
- TRACE_ALLOC_ENTER (mysqlnd_free_name );
381
-
382
- #if PHP_DEBUG
383
- {
384
- char * fn = strrchr (__zend_filename , PHP_DIR_SEPARATOR );
385
- TRACE_ALLOC_INF_FMT ("file=%-15s line=%4d" , fn ? fn + 1 :__zend_filename , __zend_lineno );
386
- }
387
- #endif
388
- TRACE_ALLOC_INF_FMT ("ptr=%p" , ptr );
389
-
390
- if (ptr ) {
391
- if (collect_memory_statistics ) {
392
- free_amount = * (size_t * )(((char * )ptr ) - sizeof (size_t ));
393
- TRACE_ALLOC_INF_FMT ("ptr=%p size=%u" , ((char * )ptr ) - sizeof (size_t ), (unsigned int ) free_amount );
394
- }
395
- free (REAL_PTR (ptr ));
396
- }
397
-
398
- if (collect_memory_statistics ) {
399
- MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2 (STAT_MEM_FREE_COUNT , 1 , STAT_MEM_FREE_AMOUNT , free_amount );
400
- }
401
- TRACE_ALLOC_VOID_RETURN ;
402
- }
403
- /* }}} */
404
-
405
-
406
257
/* {{{ _mysqlnd_pememdup */
407
258
static char * _mysqlnd_pememdup (const char * const ptr , size_t length , zend_bool persistent MYSQLND_MEM_D )
408
259
{
@@ -607,38 +458,6 @@ static void mysqlnd_zend_mm_pefree(void * ptr, zend_bool persistent MYSQLND_MEM_
607
458
/* }}} */
608
459
609
460
610
- /* {{{ mysqlnd_zend_mm_malloc */
611
- static void * mysqlnd_zend_mm_malloc (size_t size MYSQLND_MEM_D )
612
- {
613
- return malloc (size );
614
- }
615
- /* }}} */
616
-
617
-
618
- /* {{{ mysqlnd_zend_mm_calloc */
619
- static void * mysqlnd_zend_mm_calloc (unsigned int nmemb , size_t size MYSQLND_MEM_D )
620
- {
621
- return calloc (nmemb , size );
622
- }
623
- /* }}} */
624
-
625
-
626
- /* {{{ mysqlnd_zend_mm_realloc */
627
- static void * mysqlnd_zend_mm_realloc (void * ptr , size_t new_size MYSQLND_MEM_D )
628
- {
629
- return realloc (ptr , new_size );
630
- }
631
- /* }}} */
632
-
633
-
634
- /* {{{ mysqlnd_zend_mm_free */
635
- static void mysqlnd_zend_mm_free (void * ptr MYSQLND_MEM_D )
636
- {
637
- free (ptr );
638
- }
639
- /* }}} */
640
-
641
-
642
461
/* {{{ mysqlnd_zend_mm_pememdup */
643
462
static char * mysqlnd_zend_mm_pememdup (const char * const ptr , size_t length , zend_bool persistent MYSQLND_MEM_D )
644
463
{
@@ -680,10 +499,6 @@ PHPAPI struct st_mysqlnd_allocator_methods mysqlnd_allocator =
680
499
_mysqlnd_perealloc ,
681
500
_mysqlnd_efree ,
682
501
_mysqlnd_pefree ,
683
- _mysqlnd_malloc ,
684
- _mysqlnd_calloc ,
685
- _mysqlnd_realloc ,
686
- _mysqlnd_free ,
687
502
_mysqlnd_pememdup ,
688
503
_mysqlnd_pestrndup ,
689
504
_mysqlnd_pestrdup ,
@@ -699,10 +514,6 @@ PHPAPI struct st_mysqlnd_allocator_methods mysqlnd_allocator =
699
514
mysqlnd_zend_mm_perealloc ,
700
515
mysqlnd_zend_mm_efree ,
701
516
mysqlnd_zend_mm_pefree ,
702
- mysqlnd_zend_mm_malloc ,
703
- mysqlnd_zend_mm_calloc ,
704
- mysqlnd_zend_mm_realloc ,
705
- mysqlnd_zend_mm_free ,
706
517
mysqlnd_zend_mm_pememdup ,
707
518
mysqlnd_zend_mm_pestrndup ,
708
519
mysqlnd_zend_mm_pestrdup ,
0 commit comments