summaryrefslogtreecommitdiff
path: root/ext/mysqlnd/mysqlnd_alloc.c
diff options
context:
space:
mode:
authorPierre Joye <pierre.php@gmail.com>2014-05-17 15:29:25 +0200
committerPierre Joye <pierre.php@gmail.com>2014-05-17 15:29:25 +0200
commitbd1aae54ebdf16d410620002bed228f6a03d462b (patch)
tree671dc53fb0de61f8452d865d7a4fcfc5e824b35b /ext/mysqlnd/mysqlnd_alloc.c
parent77ba802726527afd5dfff4760d09f24e1d7c8058 (diff)
downloadphp-git-bd1aae54ebdf16d410620002bed228f6a03d462b.tar.gz
fix init, new smart_str struct (use zend_string now)
Diffstat (limited to 'ext/mysqlnd/mysqlnd_alloc.c')
-rw-r--r--ext/mysqlnd/mysqlnd_alloc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/mysqlnd/mysqlnd_alloc.c b/ext/mysqlnd/mysqlnd_alloc.c
index 42ce55a36a..c3228aa4f1 100644
--- a/ext/mysqlnd/mysqlnd_alloc.c
+++ b/ext/mysqlnd/mysqlnd_alloc.c
@@ -582,7 +582,7 @@ char * _mysqlnd_pestrndup(const char * const ptr, size_t length, zend_bool persi
char * _mysqlnd_pestrdup(const char * const ptr, zend_bool persistent MYSQLND_MEM_D)
{
char * ret;
- smart_str tmp_str = {0, 0, 0};
+ smart_str tmp_str = {0, 0};
const char * p = ptr;
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
TRACE_ALLOC_ENTER(mysqlnd_pestrdup_name);
@@ -597,11 +597,11 @@ char * _mysqlnd_pestrdup(const char * const ptr, zend_bool persistent MYSQLND_ME
smart_str_appendc(&tmp_str, *p);
} while (*p++);
- ret = (persistent) ? __zend_malloc(tmp_str.len + sizeof(size_t)) : _emalloc(REAL_SIZE(tmp_str.len + sizeof(size_t)) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
- memcpy(FAKE_PTR(ret), tmp_str.c, tmp_str.len);
+ ret = (persistent) ? __zend_malloc(tmp_str.s->len + sizeof(size_t)) : _emalloc(REAL_SIZE(tmp_str.s->len + sizeof(size_t)) ZEND_FILE_LINE_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
+ memcpy(FAKE_PTR(ret), tmp_str.s->val, tmp_str.s->len);
if (ret && collect_memory_statistics) {
- *(size_t *) ret = tmp_str.len;
+ *(size_t *) ret = tmp_str.s->len;
MYSQLND_INC_GLOBAL_STATISTIC(persistent? STAT_MEM_STRDUP_COUNT : STAT_MEM_ESTRDUP_COUNT);
}
smart_str_free(&tmp_str);