Skip to content

Commit

Permalink
Fix more mysqlnd debug printf formats
Browse files Browse the repository at this point in the history
These didn't show up on my system...
  • Loading branch information
nikic committed Jun 16, 2021
1 parent 3acdab8 commit 57f06b6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions ext/mysqlnd/mysqlnd_alloc.c
Expand Up @@ -73,7 +73,7 @@ static void * _mysqlnd_emalloc(size_t size MYSQLND_MEM_D)
TRACE_ALLOC_ENTER(mysqlnd_emalloc_name);
ret = emalloc_rel(REAL_SIZE(size));

TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret);
TRACE_ALLOC_INF_FMT("size=%zu ptr=%p", size, ret);

if (collect_memory_statistics) {
*(size_t *) ret = size;
Expand All @@ -92,7 +92,7 @@ static void * _mysqlnd_pemalloc(size_t size, bool persistent MYSQLND_MEM_D)
TRACE_ALLOC_ENTER(mysqlnd_pemalloc_name);
ret = pemalloc_rel(REAL_SIZE(size), persistent);

TRACE_ALLOC_INF_FMT("size=%lu ptr=%p persistent=%u", size, ret, persistent);
TRACE_ALLOC_INF_FMT("size=%zu ptr=%p persistent=%u", size, ret, persistent);

if (collect_memory_statistics) {
enum mysqlnd_collected_stats s1 = persistent? STAT_MEM_MALLOC_COUNT:STAT_MEM_EMALLOC_COUNT;
Expand All @@ -112,11 +112,11 @@ static void * _mysqlnd_ecalloc(unsigned int nmemb, size_t size MYSQLND_MEM_D)
void *ret;
bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
TRACE_ALLOC_ENTER(mysqlnd_ecalloc_name);
TRACE_ALLOC_INF_FMT("before: %lu", zend_memory_usage(FALSE));
TRACE_ALLOC_INF_FMT("before: %zu", zend_memory_usage(FALSE));
ret = ecalloc_rel(nmemb, REAL_SIZE(size));

TRACE_ALLOC_INF_FMT("after : %lu", zend_memory_usage(FALSE));
TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret);
TRACE_ALLOC_INF_FMT("after : %zu", zend_memory_usage(FALSE));
TRACE_ALLOC_INF_FMT("size=%zu ptr=%p", size, ret);
if (collect_memory_statistics) {
*(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_ECALLOC_COUNT, 1, STAT_MEM_ECALLOC_AMOUNT, size);
Expand All @@ -134,7 +134,7 @@ static void * _mysqlnd_pecalloc(unsigned int nmemb, size_t size, bool persistent
TRACE_ALLOC_ENTER(mysqlnd_pecalloc_name);
ret = pecalloc_rel(nmemb, REAL_SIZE(size), persistent);

TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret);
TRACE_ALLOC_INF_FMT("size=%zu ptr=%p", size, ret);

if (collect_memory_statistics) {
enum mysqlnd_collected_stats s1 = persistent? STAT_MEM_CALLOC_COUNT:STAT_MEM_ECALLOC_COUNT;
Expand All @@ -155,7 +155,7 @@ static void * _mysqlnd_erealloc(void *ptr, size_t new_size MYSQLND_MEM_D)
bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0;
TRACE_ALLOC_ENTER(mysqlnd_erealloc_name);
TRACE_ALLOC_INF_FMT("ptr=%p old_size=%lu, new_size=%lu", ptr, old_size, new_size);
TRACE_ALLOC_INF_FMT("ptr=%p old_size=%zu, new_size=%zu", ptr, old_size, new_size);
ret = erealloc_rel(REAL_PTR(ptr), REAL_SIZE(new_size));

TRACE_ALLOC_INF_FMT("new_ptr=%p", (char*)ret);
Expand All @@ -175,7 +175,7 @@ static void * _mysqlnd_perealloc(void *ptr, size_t new_size, bool persistent MYS
bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0;
TRACE_ALLOC_ENTER(mysqlnd_perealloc_name);
TRACE_ALLOC_INF_FMT("ptr=%p old_size=%lu new_size=%lu persistent=%u", ptr, old_size, new_size, persistent);
TRACE_ALLOC_INF_FMT("ptr=%p old_size=%zu new_size=%zu persistent=%u", ptr, old_size, new_size, persistent);
ret = perealloc_rel(REAL_PTR(ptr), REAL_SIZE(new_size), persistent);

TRACE_ALLOC_INF_FMT("new_ptr=%p", (char*)ret);
Expand Down Expand Up @@ -209,7 +209,7 @@ static void _mysqlnd_efree(void *ptr MYSQLND_MEM_D)
if (ptr) {
if (collect_memory_statistics) {
free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t));
TRACE_ALLOC_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount);
TRACE_ALLOC_INF_FMT("ptr=%p size=%zu", ((char*)ptr) - sizeof(size_t), free_amount);
}
efree_rel(REAL_PTR(ptr));
}
Expand Down Expand Up @@ -240,7 +240,7 @@ static void _mysqlnd_pefree(void *ptr, bool persistent MYSQLND_MEM_D)
if (ptr) {
if (collect_memory_statistics) {
free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t));
TRACE_ALLOC_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount);
TRACE_ALLOC_INF_FMT("ptr=%p size=%zu", ((char*)ptr) - sizeof(size_t), free_amount);
}
pefree_rel(REAL_PTR(ptr), persistent);
}
Expand Down
2 changes: 1 addition & 1 deletion ext/mysqlnd/mysqlnd_wireprotocol.c
Expand Up @@ -1259,7 +1259,7 @@ php_mysqlnd_rset_field_read(MYSQLND_CONN_DATA * conn, void * _packet)
len != MYSQLND_NULL_LENGTH)
{
BAIL_IF_NO_MORE_DATA;
DBG_INF_FMT("Def found, length %lu", len);
DBG_INF_FMT("Def found, length " ZEND_ULONG_FMT, len);
meta->def = packet->memory_pool->get_chunk(packet->memory_pool, len + 1);
memcpy(meta->def, p, len);
meta->def[len] = '\0';
Expand Down

0 comments on commit 57f06b6

Please sign in to comment.