Skip to content

Commit ff36b77

Browse files
committed
Get rid of unnecessary USED_RET()s
1 parent a077dd4 commit ff36b77

File tree

1 file changed

+52
-64
lines changed

1 file changed

+52
-64
lines changed

ext/xmlrpc/xmlrpc-epi-php.c

Lines changed: 52 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -635,32 +635,30 @@ PHP_FUNCTION(xmlrpc_encode_request)
635635

636636
set_output_options(&out, out_opts ? out_opts : 0);
637637

638-
if (USED_RET()) {
639-
xRequest = XMLRPC_RequestNew();
638+
xRequest = XMLRPC_RequestNew();
640639

641-
if (xRequest) {
642-
XMLRPC_RequestSetOutputOptions(xRequest, &out.xmlrpc_out);
643-
if (method == NULL) {
644-
XMLRPC_RequestSetRequestType(xRequest, xmlrpc_request_response);
645-
} else {
646-
XMLRPC_RequestSetMethodName(xRequest, method);
647-
XMLRPC_RequestSetRequestType(xRequest, xmlrpc_request_call);
648-
}
649-
if (Z_TYPE_P(vals) != IS_NULL) {
650-
XMLRPC_RequestSetData(xRequest, PHP_to_XMLRPC(vals));
651-
}
640+
if (xRequest) {
641+
XMLRPC_RequestSetOutputOptions(xRequest, &out.xmlrpc_out);
642+
if (method == NULL) {
643+
XMLRPC_RequestSetRequestType(xRequest, xmlrpc_request_response);
644+
} else {
645+
XMLRPC_RequestSetMethodName(xRequest, method);
646+
XMLRPC_RequestSetRequestType(xRequest, xmlrpc_request_call);
647+
}
648+
if (Z_TYPE_P(vals) != IS_NULL) {
649+
XMLRPC_RequestSetData(xRequest, PHP_to_XMLRPC(vals));
650+
}
652651

653-
outBuf = XMLRPC_REQUEST_ToXML(xRequest, 0);
654-
if (outBuf) {
655-
RETVAL_STRING(outBuf);
652+
outBuf = XMLRPC_REQUEST_ToXML(xRequest, 0);
653+
if (outBuf) {
654+
RETVAL_STRING(outBuf);
656655
#ifdef HAVE_XMLRPC_BUNDLED
657-
efree(outBuf);
656+
efree(outBuf);
658657
#else
659-
free(outBuf);
658+
free(outBuf);
660659
#endif
661-
}
662-
XMLRPC_RequestFree(xRequest, 1);
663660
}
661+
XMLRPC_RequestFree(xRequest, 1);
664662
}
665663

666664
if (strcmp(out.xmlrpc_out.xml_elem_opts.encoding, ENCODING_DEFAULT) != 0) {
@@ -681,25 +679,23 @@ PHP_FUNCTION(xmlrpc_encode)
681679
RETURN_THROWS();
682680
}
683681

684-
if (USED_RET()) {
685-
/* convert native php type to xmlrpc type */
686-
xOut = PHP_to_XMLRPC(arg1);
682+
/* convert native php type to xmlrpc type */
683+
xOut = PHP_to_XMLRPC(arg1);
687684

688-
/* generate raw xml from xmlrpc data */
689-
outBuf = XMLRPC_VALUE_ToXML(xOut, 0);
685+
/* generate raw xml from xmlrpc data */
686+
outBuf = XMLRPC_VALUE_ToXML(xOut, 0);
690687

691-
if (xOut) {
692-
if (outBuf) {
693-
RETVAL_STRING(outBuf);
688+
if (xOut) {
689+
if (outBuf) {
690+
RETVAL_STRING(outBuf);
694691
#ifdef HAVE_XMLRPC_BUNDLED
695-
efree(outBuf);
692+
efree(outBuf);
696693
#else
697-
free(outBuf);
694+
free(outBuf);
698695
#endif
699-
}
700-
/* cleanup */
701-
XMLRPC_CleanupValue(xOut);
702696
}
697+
/* cleanup */
698+
XMLRPC_CleanupValue(xOut);
703699
}
704700
}
705701
/* }}} */
@@ -747,9 +743,7 @@ PHP_FUNCTION(xmlrpc_decode_request)
747743
RETURN_THROWS();
748744
}
749745

750-
if (USED_RET()) {
751-
decode_request_worker(xml, xml_len, encoding_len ? encoding : NULL, method, return_value);
752-
}
746+
decode_request_worker(xml, xml_len, encoding_len ? encoding : NULL, method, return_value);
753747
}
754748
/* }}} */
755749

@@ -764,9 +758,7 @@ PHP_FUNCTION(xmlrpc_decode)
764758
RETURN_THROWS();
765759
}
766760

767-
if (USED_RET()) {
768-
decode_request_worker(arg1, arg1_len, arg2_len ? arg2 : NULL, NULL, return_value);
769-
}
761+
decode_request_worker(arg1, arg1_len, arg2_len ? arg2 : NULL, NULL, return_value);
770762
}
771763
/* }}} */
772764

@@ -782,18 +774,16 @@ PHP_FUNCTION(xmlrpc_server_create)
782774
RETURN_THROWS();
783775
}
784776

785-
if (USED_RET()) {
786-
xmlrpc_server_data *server;
777+
xmlrpc_server_data *server;
787778

788-
object_init_ex(return_value, xmlrpc_server_ce);
789-
server = Z_XMLRPC_SERVER_P(return_value);
779+
object_init_ex(return_value, xmlrpc_server_ce);
780+
server = Z_XMLRPC_SERVER_P(return_value);
790781

791-
array_init(&server->method_map);
792-
array_init(&server->introspection_map);
793-
server->server_ptr = XMLRPC_ServerCreate();
782+
array_init(&server->method_map);
783+
array_init(&server->introspection_map);
784+
server->server_ptr = XMLRPC_ServerCreate();
794785

795-
XMLRPC_ServerRegisterIntrospectionCallback(server->server_ptr, php_xmlrpc_introspection_callback);
796-
}
786+
XMLRPC_ServerRegisterIntrospectionCallback(server->server_ptr, php_xmlrpc_introspection_callback);
797787
}
798788
/* }}} */
799789

@@ -1103,24 +1093,22 @@ PHP_FUNCTION(xmlrpc_parse_method_descriptions)
11031093
RETURN_THROWS();
11041094
}
11051095

1106-
if (USED_RET()) {
1107-
STRUCT_XMLRPC_ERROR err = {0};
1108-
XMLRPC_VALUE xVal = XMLRPC_IntrospectionCreateDescription(arg1, &err);
1109-
if (xVal) {
1110-
XMLRPC_to_PHP(xVal, return_value);
1111-
/* dust, sweep, and mop */
1112-
XMLRPC_CleanupValue(xVal);
1096+
STRUCT_XMLRPC_ERROR err = {0};
1097+
XMLRPC_VALUE xVal = XMLRPC_IntrospectionCreateDescription(arg1, &err);
1098+
if (xVal) {
1099+
XMLRPC_to_PHP(xVal, return_value);
1100+
/* dust, sweep, and mop */
1101+
XMLRPC_CleanupValue(xVal);
1102+
} else {
1103+
/* could not create description */
1104+
if (err.xml_elem_error.parser_code) {
1105+
php_error_docref(NULL, E_WARNING, "XML parse error: [line %ld, column %ld, message: %s] Unable to create introspection data",
1106+
err.xml_elem_error.column, err.xml_elem_error.line, err.xml_elem_error.parser_error);
11131107
} else {
1114-
/* could not create description */
1115-
if (err.xml_elem_error.parser_code) {
1116-
php_error_docref(NULL, E_WARNING, "XML parse error: [line %ld, column %ld, message: %s] Unable to create introspection data",
1117-
err.xml_elem_error.column, err.xml_elem_error.line, err.xml_elem_error.parser_error);
1118-
} else {
1119-
php_error_docref(NULL, E_WARNING, "Invalid xml structure. Unable to create introspection data");
1120-
}
1121-
1122-
php_error_docref(NULL, E_WARNING, "XML parse error. no method description created");
1108+
php_error_docref(NULL, E_WARNING, "Invalid xml structure. Unable to create introspection data");
11231109
}
1110+
1111+
php_error_docref(NULL, E_WARNING, "XML parse error. no method description created");
11241112
}
11251113
}
11261114
/* }}} */

0 commit comments

Comments
 (0)