com php-src: fix init, new smart_str struct (use zend _string now): ext/mysqlnd/mysqlnd_alloc.c
| From: | Pierre Joye | Date: | Sat, 17 May 2014 13:29:25 +0000 |
| Subject: | com php-src: fix init, new smart_str struct (use zend _string now): ext/mysqlnd/mysqlnd_alloc.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-78428@lists.php.net to get a copy of this message | ||
Commit: bd1aae54ebdf16d410620002bed228f6a03d462b
Author: Pierre Joye <pierre.php@gmail.com> Sat, 17 May 2014 15:29:25 +0200
Parents: 77ba802726527afd5dfff4760d09f24e1d7c8058
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bd1aae54ebdf16d410620002bed228f6a03d462b
Log:
fix init, new smart_str struct (use zend_string now)
Changed paths:
M ext/mysqlnd/mysqlnd_alloc.c
Diff:
diff --git a/ext/mysqlnd/mysqlnd_alloc.c b/ext/mysqlnd/mysqlnd_alloc.c
index 42ce55a..c3228aa 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);