diff options
| author | Marcus Boerger <helly@php.net> | 2008-03-25 21:58:03 +0000 |
|---|---|---|
| committer | Marcus Boerger <helly@php.net> | 2008-03-25 21:58:03 +0000 |
| commit | bd366b66da9b0d7b92efab00f538d5d3aacd6f16 (patch) | |
| tree | 3ef4f479573f15c9d4ff7ad80fda48957f5560d3 | |
| parent | 1bf96fdf5ccf090f042b027bd82289b6e86563c4 (diff) | |
| download | php-git-bd366b66da9b0d7b92efab00f538d5d3aacd6f16.tar.gz | |
- Use sizeof rather than strlen and cleanup
| -rw-r--r-- | sapi/cli/php_cli.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index 8aad625450..6b0f419cf2 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -115,13 +115,13 @@ enum behavior_mode { PHP_MODE_SHOW_INI_CONFIG }; -#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; @@ -671,10 +671,9 @@ int main(int argc, char *argv[]) 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) { |
