Skip to content

Commit ef180f1

Browse files
committed
ext/iconv: Reduce scope of variables
1 parent c8b3328 commit ef180f1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ext/iconv/iconv.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -298,17 +298,18 @@ static php_output_handler *php_iconv_output_handler_init(const char *handler_nam
298298

299299
static zend_result php_iconv_output_handler(void **nothing, php_output_context *output_context)
300300
{
301-
char *s, *content_type, *mimetype = NULL;
302-
int output_status, mimetype_len = 0;
301+
char *content_type, *mimetype = NULL;
303302

304303
if (output_context->op & PHP_OUTPUT_HANDLER_START) {
305-
output_status = php_output_get_status();
304+
int output_status = php_output_get_status();
306305
if (output_status & PHP_OUTPUT_SENT) {
307306
return FAILURE;
308307
}
309308

309+
int mimetype_len = 0;
310310
if (SG(sapi_headers).mimetype && !strncasecmp(SG(sapi_headers).mimetype, "text/", 5)) {
311-
if ((s = strchr(SG(sapi_headers).mimetype,';')) == NULL){
311+
char *s = strchr(SG(sapi_headers).mimetype,';');
312+
if (s == NULL){
312313
mimetype = SG(sapi_headers).mimetype;
313314
} else {
314315
mimetype = SG(sapi_headers).mimetype;
@@ -775,7 +776,6 @@ static php_iconv_err_t _php_iconv_strpos(size_t *pretval,
775776

776777
size_t match_ofs;
777778
int more;
778-
size_t iconv_ret;
779779

780780
*pretval = (size_t)-1;
781781

@@ -812,7 +812,7 @@ static php_iconv_err_t _php_iconv_strpos(size_t *pretval,
812812

813813
more = in_left > 0;
814814

815-
iconv_ret = iconv(cd, more ? (ICONV_CONST char **)&in_p : NULL, more ? &in_left : NULL, (char **) &out_p, &out_left);
815+
size_t iconv_ret = iconv(cd, more ? (ICONV_CONST char **)&in_p : NULL, more ? &in_left : NULL, (char **) &out_p, &out_left);
816816
if (out_left == sizeof(buf)) {
817817
break;
818818
}

0 commit comments

Comments
 (0)