Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9e1090c

Browse files
committed
sapi/apache2handler: function using char * to const char *.
1 parent 33928a0 commit 9e1090c

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

‎sapi/apache2handler/php_functions.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -313,15 +313,15 @@ PHP_FUNCTION(apache_getenv)
313313
}
314314
/* }}} */
315315

316-
static char *php_apache_get_version(void)
316+
static constchar *php_apache_get_version(void)
317317
{
318-
return (char*) ap_get_server_banner();
318+
return ap_get_server_banner();
319319
}
320320

321321
/* {{{ Fetch Apache version */
322322
PHP_FUNCTION(apache_get_version)
323323
{
324-
char *apv = php_apache_get_version();
324+
constchar *apv = php_apache_get_version();
325325

326326
if (apv && *apv) {
327327
RETURN_STRING(apv);
@@ -340,7 +340,7 @@ PHP_FUNCTION(apache_get_modules)
340340
array_init(return_value);
341341

342342
for (n = 0; ap_loaded_modules[n]; ++n) {
343-
char *s = (char*) ap_loaded_modules[n]->name;
343+
constchar *s = ap_loaded_modules[n]->name;
344344
if ((p = strchr(s, '.'))) {
345345
add_next_index_stringl(return_value, s, (p - s));
346346
} else {
@@ -352,7 +352,7 @@ PHP_FUNCTION(apache_get_modules)
352352

353353
PHP_MINFO_FUNCTION(apache)
354354
{
355-
char *apv = php_apache_get_version();
355+
constchar *apv = php_apache_get_version();
356356
smart_str tmp1 = {0};
357357
char tmp[1024];
358358
int n, max_requests;
@@ -363,21 +363,20 @@ PHP_MINFO_FUNCTION(apache)
363363
#endif
364364

365365
for (n = 0; ap_loaded_modules[n]; ++n) {
366-
char *s = (char *) ap_loaded_modules[n]->name;
366+
const char *s = ap_loaded_modules[n]->name;
367+
if (n > 0) {
368+
smart_str_appendc(&tmp1, ' ');
369+
}
367370
if ((p = strchr(s, '.'))) {
368371
smart_str_appendl(&tmp1, s, (p - s));
369372
} else {
370373
smart_str_appends(&tmp1, s);
371374
}
372-
smart_str_appendc(&tmp1, ' ');
373375
}
374-
if (tmp1.s) {
375-
if (tmp1.s->len > 0) {
376-
tmp1.s->val[tmp1.s->len - 1] = '0円';
377-
} else {
378-
tmp1.s->val[0] = '0円';
379-
}
376+
if (!tmp1.s) {
377+
smart_str_appendc(&tmp1, '/');
380378
}
379+
smart_str_0(&tmp1);
381380

382381
php_info_print_table_start();
383382
if (apv && *apv) {
@@ -409,7 +408,7 @@ PHP_MINFO_FUNCTION(apache)
409408

410409
php_info_print_table_row(2, "Virtual Server", (serv->is_virtual ? "Yes" : "No"));
411410
php_info_print_table_row(2, "Server Root", ap_server_root);
412-
php_info_print_table_row(2, "Loaded Modules", tmp1.s->val);
411+
php_info_print_table_row(2, "Loaded Modules", ZSTR_VAL(tmp1.s));
413412

414413
smart_str_free(&tmp1);
415414
php_info_print_table_end();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /