Metrics
0
Watch 283 Star 1.1K Fork 254

GVPswoole / swoole-srcCApache-2.0

Clone or download
swoole_buffer.c
Copy Edit Web IDE Raw Normal History
韩天峰   Added swoole_buffer 2014-07-24
/*  +----------------------------------------------------------------------+  | Swoole                                                               |  +----------------------------------------------------------------------+  | This source file is subject to version 2.0 of the Apache license,    |  | that is bundled with this package in the file LICENSE, and is        |  | available through the world-wide-web at the following url:           |  | http://www.apache.org/licenses/LICENSE-2.0.html                      |  | If you did not receive a copy of the Apache2.0 license and are unable|  | to obtain it through the world-wide-web, please send a note to       |
韩天峰   update license email. 2015-03-04
  | license@swoole.com so we can mail you a copy immediately.            |
韩天峰   Added swoole_buffer 2014-07-24
  +----------------------------------------------------------------------+  | Author: Tianfeng Han  <mikan.tenny@gmail.com>                        |  +----------------------------------------------------------------------+*/#include "php_swoole.h"
韩天峰   added swoole_buffer_init 2015-04-17
static PHP_METHOD(swoole_buffer, __construct);static PHP_METHOD(swoole_buffer, __destruct);
韩天峰   Added swoole_buffer->__toString. 2016-02-24
static PHP_METHOD(swoole_buffer, __toString);
韩天峰   added swoole_buffer_init 2015-04-17
static PHP_METHOD(swoole_buffer, append);static PHP_METHOD(swoole_buffer, substr);
韩天峰   add swoole_buffer->read 2015-08-14
static PHP_METHOD(swoole_buffer, read);
韩天峰   added swoole_buffer_init 2015-04-17
static PHP_METHOD(swoole_buffer, write);static PHP_METHOD(swoole_buffer, expand);
有明   Added garbage recycling and auto garbage recycling in swoole_buffer. 2017-01-07
static PHP_METHOD(swoole_buffer, recycle);
韩天峰   added swoole_buffer_init 2015-04-17
static PHP_METHOD(swoole_buffer, clear);
韩天峰   update function arg info. 2016-12-20
ZEND_BEGIN_ARG_INFO_EX(arginfo_swoole_buffer_construct, 0, 0, 0)    ZEND_ARG_INFO(0, size)ZEND_END_ARG_INFO()ZEND_BEGIN_ARG_INFO_EX(arginfo_swoole_buffer_void, 0, 0, 0)ZEND_END_ARG_INFO()ZEND_BEGIN_ARG_INFO_EX(arginfo_swoole_buffer_expand, 0, 0, 1)    ZEND_ARG_INFO(0, size)ZEND_END_ARG_INFO()ZEND_BEGIN_ARG_INFO_EX(arginfo_swoole_buffer_substr, 0, 0, 1)    ZEND_ARG_INFO(0, offset)    ZEND_ARG_INFO(0, length)
twosee   Fix typo. 2019-03-13
    ZEND_ARG_INFO(0, remove)
韩天峰   update function arg info. 2016-12-20
ZEND_END_ARG_INFO()ZEND_BEGIN_ARG_INFO_EX(arginfo_swoole_buffer_write, 0, 0, 2)    ZEND_ARG_INFO(0, offset)    ZEND_ARG_INFO(0, data)ZEND_END_ARG_INFO()ZEND_BEGIN_ARG_INFO_EX(arginfo_swoole_buffer_read, 0, 0, 2)    ZEND_ARG_INFO(0, offset)    ZEND_ARG_INFO(0, length)ZEND_END_ARG_INFO()ZEND_BEGIN_ARG_INFO_EX(arginfo_swoole_buffer_append, 0, 0, 1)    ZEND_ARG_INFO(0, data)ZEND_END_ARG_INFO()
韩天峰   added swoole_buffer_init 2015-04-17
static const zend_function_entry swoole_buffer_methods[] ={
twosee   Remove useless ZEND_ACC_[C|D]TOR. 2018-10-09
    PHP_ME(swoole_buffer, __construct, arginfo_swoole_buffer_construct, ZEND_ACC_PUBLIC)    PHP_ME(swoole_buffer, __destruct, arginfo_swoole_buffer_void, ZEND_ACC_PUBLIC)
韩天峰   update function arg info. 2016-12-20
    PHP_ME(swoole_buffer, __toString, arginfo_swoole_buffer_void, ZEND_ACC_PUBLIC)    PHP_ME(swoole_buffer, substr, arginfo_swoole_buffer_substr, ZEND_ACC_PUBLIC)    PHP_ME(swoole_buffer, write, arginfo_swoole_buffer_write, ZEND_ACC_PUBLIC)    PHP_ME(swoole_buffer, read, arginfo_swoole_buffer_read, ZEND_ACC_PUBLIC)    PHP_ME(swoole_buffer, append, arginfo_swoole_buffer_append, ZEND_ACC_PUBLIC)    PHP_ME(swoole_buffer, expand, arginfo_swoole_buffer_expand, ZEND_ACC_PUBLIC)
有明   Added garbage recycling and auto garbage recycling in swoole_buffer. 2017-01-07
    PHP_ME(swoole_buffer, recycle, arginfo_swoole_buffer_void, ZEND_ACC_PUBLIC)
韩天峰   update function arg info. 2016-12-20
    PHP_ME(swoole_buffer, clear, arginfo_swoole_buffer_void, ZEND_ACC_PUBLIC)
韩天峰   added swoole_buffer_init 2015-04-17
    PHP_FE_END};
twosee   Rename "ce_ptr" to "ce" (class entry). 2019-04-04
zend_class_entry *swoole_buffer_ce;
twosee   Add zend_object_handlers (prepare for handling clonable). 2018-11-28
static zend_object_handlers swoole_buffer_handlers;
韩天峰   added swoole_buffer_init 2015-04-17
twosee   Remove TSMR macros. 2018-09-26
void swoole_buffer_init(int module_number)
韩天峰   added swoole_buffer_init 2015-04-17
{
twosee   Standardize macro names (SWOOLE_* to SW_*). 2019-04-04
    SW_INIT_CLASS_ENTRY(swoole_buffer, "Swoole\\Buffer", "swoole_buffer", NULL, swoole_buffer_methods);    SW_SET_CLASS_SERIALIZABLE(swoole_buffer, zend_class_serialize_deny, zend_class_unserialize_deny);
twosee   Add sw_ namespace 2019-06-14
    SW_SET_CLASS_CLONEABLE(swoole_buffer, sw_zend_class_clone_deny);
twosee   Add sw_zend_create_object_deny and a test for it, add SW_SET_CLASS_CRE… 2019-05-13
    SW_SET_CLASS_UNSET_PROPERTY_HANDLER(swoole_buffer, sw_zend_class_unset_property_deny);    // SW_SET_CLASS_CREATE_WITH_ITS_OWN_HANDLERS(swoole_buffer);
twosee   Fix Swoole\Buffer declaration. 2019-03-13
twosee   Rename "ce_ptr" to "ce" (class entry). 2019-04-04
    zend_declare_property_long(swoole_buffer_ce, ZEND_STRL("capacity"), SW_STRING_BUFFER_DEFAULT, ZEND_ACC_PUBLIC);    zend_declare_property_long(swoole_buffer_ce, ZEND_STRL("length"), 0, ZEND_ACC_PUBLIC);
韩天峰   added swoole_buffer_init 2015-04-17
}
韩天峰   allow swoole_buffer->recycle all memory. 2017-06-30
static void swoole_buffer_recycle(swString *buffer)
有明   Added garbage recycling and auto garbage recycling in swoole_buffer. 2017-01-07
{
韩天峰   allow swoole_buffer->recycle all memory. 2017-06-30
    if (buffer->offset == 0)    {
有明   Added garbage recycling and auto garbage recycling in swoole_buffer. 2017-01-07
        return;    }
韩天峰   added swString_pop_front 2019-03-08
    swString_pop_front(buffer, buffer->offset);
有明   Added garbage recycling and auto garbage recycling in swoole_buffer. 2017-01-07
}
韩天峰   added swoole_buffer_init 2015-04-17
static PHP_METHOD(swoole_buffer, __construct)
韩天峰   Added swoole_buffer 2014-07-24
{
韩天峰   rename 2019-06-13
    php_swoole_fatal_error(
twosee   Deprecate Swoole\Buffer and Swoole\Lock. 2019-05-27
        E_DEPRECATED, "Class %s is deprecated, it will be removed in v4.5.0",        ZSTR_VAL(swoole_buffer_ce->name)    );
twosee   Throw exception when construct failed. 2019-03-12
    zend_long size = SW_STRING_BUFFER_DEFAULT;
韩天峰   Added swoole_buffer 2014-07-24
twosee   Throw exception when construct failed. 2019-03-12
    ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 0, 1)        Z_PARAM_OPTIONAL        Z_PARAM_LONG(size)    ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
韩天峰   Added swoole_buffer 2014-07-24
    if (size < 1)    {
twosee   Rename "ce_ptr" to "ce" (class entry). 2019-04-04
        zend_throw_exception(swoole_exception_ce, "buffer size can't be less than 0", SW_ERROR_INVALID_PARAMS);
韩天峰   Added swoole_buffer 2014-07-24
        RETURN_FALSE;    }    else if (size > SW_STRING_BUFFER_MAXLEN)    {
twosee   Rename "ce_ptr" to "ce" (class entry). 2019-04-04
        zend_throw_exception_ex(swoole_exception_ce, errno, "buffer size can't exceed %d", SW_STRING_BUFFER_MAXLEN);
韩天峰   Added swoole_buffer 2014-07-24
        RETURN_FALSE;    }    swString *buffer = swString_new(size);    if (buffer == NULL)    {
twosee   Rename "ce_ptr" to "ce" (class entry). 2019-04-04
        zend_throw_exception_ex(swoole_exception_ce, errno, "malloc(" ZEND_LONG_FMT ") failed", size);
韩天峰   Added swoole_buffer 2014-07-24
        RETURN_FALSE;    }
twosee   Use ZEND_THIS 2019-07-03
    swoole_set_object(ZEND_THIS, buffer);    zend_update_property_long(swoole_buffer_ce, ZEND_THIS, ZEND_STRL("capacity"), size);    zend_update_property_long(swoole_buffer_ce, ZEND_THIS, ZEND_STRL("length"), 0);
韩天峰   Optimize code style. 2015-04-17
}
韩天峰   added swoole_buffer_init 2015-04-17
static PHP_METHOD(swoole_buffer, __destruct)
韩天峰   Optimize code style. 2015-04-17
{
twosee   Standardize macro names (SWOOLE_* to SW_*). 2019-04-04
    SW_PREVENT_USER_DESTRUCT();
twosee   To prevent all destruct by user. 2018-07-21
twosee   Use ZEND_THIS 2019-07-03
    swString *buffer = swoole_get_object(ZEND_THIS);
韩天峰   Optimize code style. 2015-04-17
    if (buffer)    {        swString_free(buffer);    }
twosee   Use ZEND_THIS 2019-07-03
    swoole_set_object(ZEND_THIS, NULL);
韩天峰   Added swoole_buffer 2014-07-24
}
韩天峰   added swoole_buffer_init 2015-04-17
static PHP_METHOD(swoole_buffer, append)
韩天峰   Added swoole_buffer 2014-07-24
{    swString str;
韩天峰   Added table src 2014-07-25
    bzero(&str, sizeof(str));
韩天峰   Added swoole_buffer 2014-07-24
twosee   Remove TSMR macros. 2018-09-26
    if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str.str, &str.length) == FAILURE)
韩天峰   Added swoole_buffer 2014-07-24
    {        RETURN_FALSE;    }    if (str.length < 1)    {
twosee   RTrim error info. 2019-04-03
        php_error_docref(NULL, E_WARNING, "string empty");
韩天峰   Added swoole_buffer 2014-07-24
        RETURN_FALSE;    }
twosee   Use ZEND_THIS 2019-07-03
    swString *buffer = swoole_get_object(ZEND_THIS);
韩天峰   Added table src 2014-07-25
有明   Enabled using all extended memory in swoole_buffer. 2017-01-07
    if ((str.length + buffer->length) > buffer->size && (str.length + buffer->length) > SW_STRING_BUFFER_MAXLEN)
韩天峰   Added swoole_buffer 2014-07-24
    {
twosee   Remove TSMR macros. 2018-09-26
        php_error_docref(NULL, E_WARNING, "buffer size can't exceed %d", SW_STRING_BUFFER_MAXLEN);
韩天峰   Added table src 2014-07-25
        RETURN_FALSE;
韩天峰   Added swoole_buffer 2014-07-24
    }    size_t size_old = buffer->size;    if (swString_append(buffer, &str) == SW_OK)    {        if (buffer->size > size_old)        {
twosee   Use ZEND_THIS 2019-07-03
            zend_update_property_long(swoole_buffer_ce, ZEND_THIS, ZEND_STRL("capacity"), buffer->size);
韩天峰   Added swoole_buffer 2014-07-24
        }
twosee   Use ZEND_THIS 2019-07-03
        zend_update_property_long(swoole_buffer_ce, ZEND_THIS, ZEND_STRL("length"),
twosee   Remove TSMR macros. 2018-09-26
                buffer->length - buffer->offset);
有明   Fixed length error after append new string. 2017-01-07
        RETURN_LONG(buffer->length - buffer->offset);
韩天峰   Added swoole_buffer 2014-07-24
    }    else    {        RETURN_FALSE;    }}
韩天峰   added swoole_buffer_init 2015-04-17
static PHP_METHOD(swoole_buffer, substr)
韩天峰   Added swoole_buffer 2014-07-24
{
twosee   Fix optional args parse codes. 2019-01-04
    zend_long offset;    zend_long length = -1;
有明   Made variable's name more suitable. 2017-01-05
    zend_bool remove = 0;
韩天峰   Added swoole_buffer 2014-07-24
twosee   Remove TSMR macros. 2018-09-26
    if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|lb", &offset, &length, &remove) == FAILURE)
韩天峰   Added swoole_buffer 2014-07-24
    {        RETURN_FALSE;    }
twosee   Use ZEND_THIS 2019-07-03
    swString *buffer = swoole_get_object(ZEND_THIS);
韩天峰   Added table src 2014-07-25
韩天峰   allow swoole_buffer->recycle all memory. 2017-06-30
    if (remove && !(offset == 0 && length <= buffer->length))
韩天峰   Added table src 2014-07-25
    {
有明   Made variable's name more suitable. 2017-01-05
        remove = 0;
韩天峰   Added table src 2014-07-25
    }
韩天峰   Added swoole_buffer 2014-07-24
    if (offset < 0)    {        offset = buffer->length + offset;    }
韩天峰   Added table src 2014-07-25
    offset += buffer->offset;
韩天峰   Added swoole_buffer 2014-07-24
    if (length < 0)    {        length = buffer->length - offset;    }
twosee   Fix warnings. 2019-01-29
    if (length + offset > buffer->length)
韩天峰   Added table src 2014-07-25
    {
韩天峰   rename 2019-06-13
        php_swoole_error(E_WARNING, "offset(" ZEND_LONG_FMT ", " ZEND_LONG_FMT ") is out of bounds", offset, length);
韩天峰   Added table src 2014-07-25
        RETURN_FALSE;    }
有明   Made variable's name more suitable. 2017-01-05
    if (remove)
韩天峰   Added table src 2014-07-25
    {        buffer->offset += length;
twosee   Use ZEND_THIS 2019-07-03
        zend_update_property_long(swoole_buffer_ce, ZEND_THIS, ZEND_STRL("length"), buffer->length - buffer->offset);
有明   Added garbage recycling and auto garbage recycling in swoole_buffer. 2017-01-07
韩天峰   allow swoole_buffer->recycle all memory. 2017-06-30
        if (buffer->offset > SW_STRING_BUFFER_GARBAGE_MIN && buffer->offset * SW_STRING_BUFFER_GARBAGE_RATIO > buffer->size)        {
有明   Added garbage recycling and auto garbage recycling in swoole_buffer. 2017-01-07
            swoole_buffer_recycle(buffer);        }
韩天峰   Added table src 2014-07-25
    }
twosee   Remove useless PHP5 wrapper macro[2] 2018-09-20
    RETURN_STRINGL(buffer->str + offset, length);
韩天峰   Added swoole_buffer 2014-07-24
}
韩天峰   Added swoole_buffer->__toString. 2016-02-24
static PHP_METHOD(swoole_buffer, __toString){
twosee   Use ZEND_THIS 2019-07-03
    swString *buffer = swoole_get_object(ZEND_THIS);
twosee   Remove useless PHP5 wrapper macro[2] 2018-09-20
    RETURN_STRINGL(buffer->str + buffer->offset, buffer->length - buffer->offset);
韩天峰   Added swoole_buffer->__toString. 2016-02-24
}
韩天峰   added swoole_buffer_init 2015-04-17
static PHP_METHOD(swoole_buffer, write)
韩天峰   Added swoole_buffer 2014-07-24
{    long offset;
有明   Enabled auto expanding in swoole_buffer::write(). 2017-01-07
    swString str;    bzero(&str, sizeof(str));
韩天峰   Added swoole_buffer 2014-07-24
twosee   Remove TSMR macros. 2018-09-26
    if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &offset, &str.str, &str.length) == FAILURE)
韩天峰   Added swoole_buffer 2014-07-24
    {        RETURN_FALSE;    }
有明   Enabled auto expanding in swoole_buffer::write(). 2017-01-07
    if (str.length < 1)    {
twosee   RTrim error info. 2019-04-03
        php_error_docref(NULL, E_WARNING, "string to write is empty");
有明   Enabled auto expanding in swoole_buffer::write(). 2017-01-07
        RETURN_FALSE;    }
twosee   Use ZEND_THIS 2019-07-03
    swString *buffer = swoole_get_object(ZEND_THIS);
有明   Enabled auto expanding in swoole_buffer::write(). 2017-01-07
韩天峰   Added swoole_buffer 2014-07-24
    if (offset < 0)    {
有明   Enabled auto expanding in swoole_buffer::write(). 2017-01-07
        offset = buffer->length - buffer->offset + offset;
韩天峰   Added swoole_buffer 2014-07-24
    }
有明   Enabled auto expanding in swoole_buffer::write(). 2017-01-07
    if (offset < 0)    {
twosee   RTrim error info. 2019-04-03
        php_error_docref(NULL, E_WARNING, "offset(%ld) is out of bounds", offset);
有明   Enabled auto expanding in swoole_buffer::write(). 2017-01-07
        RETURN_FALSE;    }
韩天峰   Added table src 2014-07-25
    offset += buffer->offset;
有明   Enabled auto expanding in swoole_buffer::write(). 2017-01-07
有明   Added garbage recycling and auto garbage recycling in swoole_buffer. 2017-01-07
    if ((str.length + offset) > buffer->size && (str.length + offset) > SW_STRING_BUFFER_MAXLEN)
有明   Added max size checking in swoole_buffer::write() 2017-01-07
    {
twosee   Remove TSMR macros. 2018-09-26
        php_error_docref(NULL, E_WARNING, "buffer size can't exceed %d", SW_STRING_BUFFER_MAXLEN);
有明   Added max size checking in swoole_buffer::write() 2017-01-07
        RETURN_FALSE;    }
有明   Enabled auto expanding in swoole_buffer::write(). 2017-01-07
    size_t size_old = buffer->size;    if (swString_write(buffer, offset, &str) == SW_OK)    {        if (buffer->size > size_old)        {
twosee   Use ZEND_THIS 2019-07-03
            zend_update_property_long(swoole_buffer_ce, ZEND_THIS, ZEND_STRL("capacity"), buffer->size);
有明   Enabled auto expanding in swoole_buffer::write(). 2017-01-07
        }
twosee   Use ZEND_THIS 2019-07-03
        zend_update_property_long(swoole_buffer_ce, ZEND_THIS, ZEND_STRL("length"),
twosee   Remove TSMR macros. 2018-09-26
                buffer->length - buffer->offset);
有明   Enabled auto expanding in swoole_buffer::write(). 2017-01-07
        RETURN_LONG(buffer->length - buffer->offset);    }    else
韩天峰   Added swoole_buffer 2014-07-24
    {        RETURN_FALSE;    }}
韩天峰   add swoole_buffer->read 2015-08-14
static PHP_METHOD(swoole_buffer, read){    long offset;    long length;
twosee   Remove TSMR macros. 2018-09-26
    if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll", &offset, &length) == FAILURE)
韩天峰   add swoole_buffer->read 2015-08-14
    {        RETURN_FALSE;    }
有明   Fixed size and length bugs in swoole_buffer. 2017-01-07
twosee   Use ZEND_THIS 2019-07-03
    swString *buffer = swoole_get_object(ZEND_THIS);
有明   Fixed size and length bugs in swoole_buffer. 2017-01-07
韩天峰   add swoole_buffer->read 2015-08-14
    if (offset < 0)    {
有明   Fixed size and length bugs in swoole_buffer. 2017-01-07
        offset = buffer->length - buffer->offset + offset;    }    if (offset < 0)    {
twosee   RTrim error info. 2019-04-03
        php_error_docref(NULL, E_WARNING, "offset(%ld) is out of bounds", offset);
有明   Fixed size and length bugs in swoole_buffer. 2017-01-07
        RETURN_FALSE;
韩天峰   add swoole_buffer->read 2015-08-14
    }
有明   Fixed size and length bugs in swoole_buffer. 2017-01-07
韩天峰   add swoole_buffer->read 2015-08-14
    offset += buffer->offset;
有明   Fixed size and length bugs in swoole_buffer. 2017-01-07
有明   fixed #993 2016-12-31
    if (length > buffer->length - offset)
韩天峰   add swoole_buffer->read 2015-08-14
    {        RETURN_FALSE;    }
有明   Fixed size and length bugs in swoole_buffer. 2017-01-07
twosee   Remove useless PHP5 wrapper macro[2] 2018-09-20
    RETURN_STRINGL(buffer->str + offset, length);
韩天峰   add swoole_buffer->read 2015-08-14
}
韩天峰   added swoole_buffer_init 2015-04-17
static PHP_METHOD(swoole_buffer, expand)
韩天峰   Added swoole_buffer 2014-07-24
{    long size = -1;
有明   Fixed size and length bugs in swoole_buffer. 2017-01-07
twosee   Remove TSMR macros. 2018-09-26
    if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &size) == FAILURE)
韩天峰   Added swoole_buffer 2014-07-24
    {        RETURN_FALSE;    }
有明   Fixed size and length bugs in swoole_buffer. 2017-01-07
twosee   Use ZEND_THIS 2019-07-03
    swString *buffer = swoole_get_object(ZEND_THIS);
有明   Fixed size and length bugs in swoole_buffer. 2017-01-07
韩天峰   Added swoole_buffer 2014-07-24
    if (size <= buffer->size)    {
twosee   Remove TSMR macros. 2018-09-26
        php_error_docref(NULL, E_WARNING, "new size must be more than %ld", buffer->size);
韩天峰   Added swoole_buffer 2014-07-24
        RETURN_FALSE;    }
有明   Fixed size and length bugs in swoole_buffer. 2017-01-07
    if (swString_extend(buffer, size) == SW_OK)    {
twosee   Use ZEND_THIS 2019-07-03
        zend_update_property_long(swoole_buffer_ce, ZEND_THIS, ZEND_STRL("capacity"), size);
有明   Fixed size and length bugs in swoole_buffer. 2017-01-07
        RETURN_TRUE;    }    else    {        RETURN_FALSE;    }
韩天峰   Added swoole_buffer 2014-07-24
}
韩天峰   Added table src 2014-07-25
有明   Added garbage recycling and auto garbage recycling in swoole_buffer. 2017-01-07
static PHP_METHOD(swoole_buffer, recycle){
twosee   Use ZEND_THIS 2019-07-03
    swString *buffer = swoole_get_object(ZEND_THIS);
有明   Added garbage recycling and auto garbage recycling in swoole_buffer. 2017-01-07
    swoole_buffer_recycle(buffer);
twosee   Use ZEND_THIS 2019-07-03
    zend_update_property_long(swoole_buffer_ce, ZEND_THIS, ZEND_STRL("length"), buffer->length);
有明   Added garbage recycling and auto garbage recycling in swoole_buffer. 2017-01-07
}
韩天峰   added swoole_buffer_init 2015-04-17
static PHP_METHOD(swoole_buffer, clear)
韩天峰   Added table src 2014-07-25
{
twosee   Use ZEND_THIS 2019-07-03
    swString *buffer = swoole_get_object(ZEND_THIS);
韩天峰   Added table src 2014-07-25
    buffer->length = 0;    buffer->offset = 0;
twosee   Use ZEND_THIS 2019-07-03
    zend_update_property_long(swoole_buffer_ce, ZEND_THIS, ZEND_STRL("length"), 0);
韩天峰   Added table src 2014-07-25
}

Help Search

183227_9af5e6a8_1826025 111910_4d91f001_1826025