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 370396a

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

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

‎sapi/apache2handler/php_functions.c

Lines changed: 10 additions & 13 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,18 @@ 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+
constchar *s = ap_loaded_modules[n]->name;
367367
if ((p = strchr(s, '.'))) {
368368
smart_str_appendl(&tmp1, s, (p - s));
369369
} else {
370370
smart_str_appends(&tmp1, s);
371371
}
372372
smart_str_appendc(&tmp1, ' ');
373373
}
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-
}
374+
if (!tmp1.s) {
375+
smart_str_appendc(&tmp1, '/');
380376
}
377+
smart_str_0(&tmp1);
381378

382379
php_info_print_table_start();
383380
if (apv && *apv) {
@@ -409,7 +406,7 @@ PHP_MINFO_FUNCTION(apache)
409406

410407
php_info_print_table_row(2, "Virtual Server", (serv->is_virtual ? "Yes" : "No"));
411408
php_info_print_table_row(2, "Server Root", ap_server_root);
412-
php_info_print_table_row(2, "Loaded Modules", tmp1.s->val);
409+
php_info_print_table_row(2, "Loaded Modules", ZSTR_VAL(tmp1.s));
413410

414411
smart_str_free(&tmp1);
415412
php_info_print_table_end();

0 commit comments

Comments
(0)

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