com php-src: Only write single terminating byte: ext/mbstring/l ibmbfl/mbfl/mbfl_memory_device.c
| From: | Nikita Popov | Date: | Thu, 20 Jul 2017 19:41:52 +0000 |
| Subject: | com php-src: Only write single terminating byte: ext/mbstring/l ibmbfl/mbfl/mbfl_memory_device.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-98671@lists.php.net to get a copy of this message | ||
Commit: a319063aaeaad817cd777a373c5b8ac6a26950d1
Author: Nikita Popov <nikita.ppv@gmail.com> Thu, 20 Jul 2017 21:14:01 +0200
Parents: 1388751f10799a240fa4cd62285c3b5c7acb235b
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a319063aaeaad817cd777a373c5b8ac6a26950d1
Log:
Only write single terminating byte
As far as I could determine this is sufficient. It avoids
reallocating the buffer, if it was perfectly allocated beforehand.
Changed paths:
M ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c
Diff:
diff --git a/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c
b/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c
index 5a28613..176a752 100644
--- a/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c
+++ b/ext/mbstring/libmbfl/mbfl/mbfl_memory_device.c
@@ -119,7 +119,7 @@ mbfl_memory_device_result(mbfl_memory_device *device, mbfl_string *result)
{
if (device && result) {
result->len = device->pos;
- mbfl_memory_device_output4('\0', device);
+ mbfl_memory_device_output('\0', device);
result->val = device->buffer;
device->buffer = (unsigned char *)0;
device->length = 0;