From: Michael Wallner Date: Fri, 22 May 2015 07:29:42 +0000 (+0200) Subject: fix warning, and place bet on the safe side X-Git-Tag: RELEASE_2_5_0~4 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=41cb14f7126c9e0c13fc9df9e4e385c2a57bcb3b;p=m6w6%2Fext-http fix warning, and place bet on the safe side --- diff --git a/php_http_message_parser.c b/php_http_message_parser.c index 3b55efb..fae16f1 100644 --- a/php_http_message_parser.c +++ b/php_http_message_parser.c @@ -61,19 +61,21 @@ php_http_message_parser_t *php_http_message_parser_init(php_http_message_parser_ php_http_message_parser_state_t php_http_message_parser_state_push(php_http_message_parser_t *parser, unsigned argc, ...) { - php_http_message_parser_state_t state; + php_http_message_parser_state_t state = PHP_HTTP_MESSAGE_PARSER_STATE_FAILURE; va_list va_args; unsigned i; - /* short circuit */ - ZEND_PTR_STACK_RESIZE_IF_NEEDED((&parser->stack), argc); + if (argc > 0) { + /* short circuit */ + ZEND_PTR_STACK_RESIZE_IF_NEEDED((&parser->stack), argc); - va_start(va_args, argc); - for (i = 0; i < argc; ++i) { - state = va_arg(va_args, php_http_message_parser_state_t); - zend_ptr_stack_push(&parser->stack, (void *) state); + va_start(va_args, argc); + for (i = 0; i < argc; ++i) { + state = va_arg(va_args, php_http_message_parser_state_t); + zend_ptr_stack_push(&parser->stack, (void *) state); + } + va_end(va_args); } - va_end(va_args); return state; }