helly Tue Mar 25 21:58:29 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/sapi/cli php_cli.c Log: - MFH Use sizeof rather than strlen and cleanup http://cvs.php.net/viewvc.cgi/php-src/sapi/cli/php_cli.c?r1=1.129.2.13.2.22.2.7&r2=1.129.2.13.2.22.2.8&diff_format=u Index: php-src/sapi/cli/php_cli.c diff -u php-src/sapi/cli/php_cli.c:1.129.2.13.2.22.2.7 php-src/sapi/cli/php_cli.c:1.129.2.13.2.22.2.8 --- php-src/sapi/cli/php_cli.c:1.129.2.13.2.22.2.7 Tue Mar 18 22:23:21 2008 +++ php-src/sapi/cli/php_cli.c Tue Mar 25 21:58:29 2008 @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_cli.c,v 1.129.2.13.2.22.2.7 2008/03/18 22:23:21 rasmus Exp $ */ +/* $Id: php_cli.c,v 1.129.2.13.2.22.2.8 2008/03/25 21:58:29 helly Exp $ */ #include "php.h" #include "php_globals.h" @@ -111,13 +111,13 @@ #define PHP_MODE_REFLECTION_EXT_INFO 11 #define PHP_MODE_SHOW_INI_CONFIG 12 -#define HARDCODED_INI \ - "html_errors=0\n" \ - "register_argc_argv=1\n" \ - "implicit_flush=1\n" \ - "output_buffering=0\n" \ - "max_execution_time=0\n" \ - "max_input_time=-1\n" +const char HARDCODED_INI[] = + "html_errors=0\n" + "register_argc_argv=1\n" + "implicit_flush=1\n" + "output_buffering=0\n" + "max_execution_time=0\n" + "max_input_time=-1\n\0"; static char *php_optarg = NULL; static int php_optind = 1; @@ -659,10 +659,9 @@ setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */ #endif - ini_entries_len = strlen(HARDCODED_INI); - cli_sapi_module.ini_entries = malloc(ini_entries_len+2); - memcpy(cli_sapi_module.ini_entries, HARDCODED_INI, ini_entries_len+1); - cli_sapi_module.ini_entries[ini_entries_len+1] = 0; + ini_entries_len = sizeof(HARDCODED_INI)-2; + cli_sapi_module.ini_entries = malloc(sizeof(HARDCODED_INI)); + memcpy(cli_sapi_module.ini_entries, HARDCODED_INI, sizeof(HARDCODED_INI)); while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0, 2))!=-1) { switch (c) {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php