Skip to content

Commit

Permalink
optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFreeman committed Jul 21, 2024
1 parent ff1a0c0 commit ff5ec6a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions ext-src/swoole_http_cookie.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ static PHP_METHOD(swoole_http_cookie, withName) {

zend_string_addref(name);
cookie->name = name;
RETURN_OBJ_COPY(Z_OBJ_P(ZEND_THIS));
RETURN_ZVAL(ZEND_THIS, 1, 0);
}

static PHP_METHOD(swoole_http_cookie, withValue) {
Expand All @@ -158,7 +158,7 @@ static PHP_METHOD(swoole_http_cookie, withValue) {
cookie->value = value;
cookie->encode = encode;
}
RETURN_OBJ_COPY(Z_OBJ_P(ZEND_THIS));
RETURN_ZVAL(ZEND_THIS, 1, 0);
}

static PHP_METHOD(swoole_http_cookie, withExpires) {
Expand All @@ -171,7 +171,7 @@ static PHP_METHOD(swoole_http_cookie, withExpires) {
ZEND_PARSE_PARAMETERS_END();

cookie->expires = expires;
RETURN_OBJ_COPY(Z_OBJ_P(ZEND_THIS));
RETURN_ZVAL(ZEND_THIS, 1, 0);
}

static PHP_METHOD(swoole_http_cookie, withPath) {
Expand All @@ -190,7 +190,7 @@ static PHP_METHOD(swoole_http_cookie, withPath) {

zend_string_addref(path);
cookie->path = path;
RETURN_OBJ_COPY(Z_OBJ_P(ZEND_THIS));
RETURN_ZVAL(ZEND_THIS, 1, 0);
}

static PHP_METHOD(swoole_http_cookie, withDomain) {
Expand All @@ -209,7 +209,7 @@ static PHP_METHOD(swoole_http_cookie, withDomain) {

zend_string_addref(domain);
cookie->domain = domain;
RETURN_OBJ_COPY(Z_OBJ_P(ZEND_THIS));
RETURN_ZVAL(ZEND_THIS, 1, 0);
}

static PHP_METHOD(swoole_http_cookie, withSecure) {
Expand All @@ -222,7 +222,7 @@ static PHP_METHOD(swoole_http_cookie, withSecure) {
ZEND_PARSE_PARAMETERS_END();

cookie->secure = secure;
RETURN_OBJ_COPY(Z_OBJ_P(ZEND_THIS));
RETURN_ZVAL(ZEND_THIS, 1, 0);
}

static PHP_METHOD(swoole_http_cookie, withHttpOnly) {
Expand All @@ -235,7 +235,7 @@ static PHP_METHOD(swoole_http_cookie, withHttpOnly) {
ZEND_PARSE_PARAMETERS_END();

cookie->httpOnly = httpOnly;
RETURN_OBJ_COPY(Z_OBJ_P(ZEND_THIS));
RETURN_ZVAL(ZEND_THIS, 1, 0);
}

static PHP_METHOD(swoole_http_cookie, withSameSite) {
Expand All @@ -254,7 +254,7 @@ static PHP_METHOD(swoole_http_cookie, withSameSite) {

zend_string_addref(sameSite);
cookie->sameSite = sameSite;
RETURN_OBJ_COPY(Z_OBJ_P(ZEND_THIS));
RETURN_ZVAL(ZEND_THIS, 1, 0);
}

static PHP_METHOD(swoole_http_cookie, withPriority) {
Expand All @@ -273,7 +273,7 @@ static PHP_METHOD(swoole_http_cookie, withPriority) {

zend_string_addref(priority);
cookie->priority = priority;
RETURN_OBJ_COPY(Z_OBJ_P(ZEND_THIS));
RETURN_ZVAL(ZEND_THIS, 1, 0);
}

static PHP_METHOD(swoole_http_cookie, withPartitioned) {
Expand All @@ -286,7 +286,7 @@ static PHP_METHOD(swoole_http_cookie, withPartitioned) {
ZEND_PARSE_PARAMETERS_END();

cookie->partitioned = partitioned;
RETURN_OBJ_COPY(Z_OBJ_P(ZEND_THIS));
RETURN_ZVAL(ZEND_THIS, 1, 0);
}

static PHP_METHOD(swoole_http_cookie, getCookie) {
Expand Down

0 comments on commit ff5ec6a

Please sign in to comment.