diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2005-07-11 18:29:46 +0300 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2005-07-12 18:46:34 +0000 |
commit | e352bcff231c07cf21f07ae801f374a3da3229ed (patch) | |
tree | 362ddec7569a75cf6e103cb1babaf1bffa4929b8 /util.c | |
parent | 282e17420839364a06808f9f85ab641c510d8296 (diff) | |
download | perl-e352bcff231c07cf21f07ae801f374a3da3229ed.tar.gz |
Make PERL_MEM_LOG more portable.
Message-Id: <42D2663A.4050204@gmail.com>
p4raw-id: //depot/perl@25128
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -4960,17 +4960,19 @@ Perl_free_global_struct(pTHX_ struct perl_vars *plvarsp) #ifdef PERL_MEM_LOG +#define PERL_MEM_LOG_SPRINTF_BUF_SIZE 128 + Malloc_t Perl_mem_log_alloc(const UV n, const UV typesize, const char *typename, Malloc_t newalloc, const char *filename, const int linenumber, const char *funcname) { #ifdef PERL_MEM_LOG_STDERR - /* We can't use PerlIO_printf() for obvious reasons. */ - char buf[1024]; + /* We can't use PerlIO for obvious reasons. */ + char buf[PERL_MEM_LOG_SPRINTF_BUF_SIZE]; sprintf(buf, "alloc: %s:%d:%s: %"IVdf" %"UVuf" %s = %"IVdf": %"UVxf"\n", filename, linenumber, funcname, n, typesize, typename, n * typesize, PTR2UV(newalloc)); - write(2, buf, strlen(buf)); + PerlLIO_write(2, buf, strlen(buf)); #endif return newalloc; } @@ -4979,13 +4981,13 @@ Malloc_t Perl_mem_log_realloc(const UV n, const UV typesize, const char *typename, Malloc_t oldalloc, Malloc_t newalloc, const char *filename, const int linenumber, const char *funcname) { #ifdef PERL_MEM_LOG_STDERR - /* We can't use PerlIO_printf() for obvious reasons. */ - char buf[1024]; + /* We can't use PerlIO for obvious reasons. */ + char buf[PERL_MEM_LOG_SPRINTF_BUF_SIZE]; sprintf(buf, "realloc: %s:%d:%s: %"IVdf" %"UVuf" %s = %"IVdf": %"UVxf" -> %"UVxf"\n", filename, linenumber, funcname, n, typesize, typename, n * typesize, PTR2UV(oldalloc), PTR2UV(newalloc)); - write(2, buf, strlen(buf)); + PerlLIO_write(2, buf, strlen(buf)); #endif return newalloc; } @@ -4994,11 +4996,11 @@ Malloc_t Perl_mem_log_free(Malloc_t oldalloc, const char *filename, const int linenumber, const char *funcname) { #ifdef PERL_MEM_LOG_STDERR - /* We can't use PerlIO_printf() for obvious reasons. */ - char buf[1024]; + /* We can't use PerlIO for obvious reasons. */ + char buf[PERL_MEM_LOG_SPRINTF_BUF_SIZE]; sprintf(buf, "free: %s:%d:%s: %"UVxf"\n", filename, linenumber, funcname, PTR2UV(oldalloc)); - write(2, buf, strlen(buf)); + PerlLIO_write(2, buf, strlen(buf)); #endif return oldalloc; } |