cvs: php-src /ext/standard info.c info.h
| From: | Marcus Boerger | Date: | Tue, 23 Jan 2007 19:58:46 +0000 |
| Subject: | cvs: php-src /ext/standard info.c info.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-42866@lists.php.net to get a copy of this message | ||
helly Tue Jan 23 19:58:46 2007 UTC
Modified files:
/php-src/ext/standard info.c info.h
Log:
- Simplify
- Add PHPAPI php_info_print_module()
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/info.c?r1=1.275&r2=1.276&diff_format=u
Index: php-src/ext/standard/info.c
diff -u php-src/ext/standard/info.c:1.275 php-src/ext/standard/info.c:1.276
--- php-src/ext/standard/info.c:1.275 Tue Jan 23 15:47:28 2007
+++ php-src/ext/standard/info.c Tue Jan 23 19:58:45 2007
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: info.c,v 1.275 2007/01/23 15:47:28 johannes Exp $ */
+/* $Id: info.c,v 1.276 2007/01/23 19:58:45 helly Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -174,13 +174,9 @@
}
}
-/* {{{ _display_module_info
-*/
-static int _display_module_info(zend_module_entry *module, void *arg TSRMLS_DC)
+PHPAPI void php_info_print_module(zend_module_entry *module TSRMLS_DC) /* {{{ */
{
- int show_info_func = *((int *) arg);
-
- if (show_info_func && module->info_func) {
+ if (module->info_func) {
if (!sapi_module.phpinfo_as_text) {
php_info_printf("<h2><a
name=\"module_%s\">%s</a></h2>\n", module->name, module->name);
} else {
@@ -189,7 +185,7 @@
php_info_print_table_end();
}
module->info_func(module TSRMLS_CC);
- } else if (!show_info_func && !module->info_func) {
+ } else {
if (!sapi_module.phpinfo_as_text) {
php_info_printf("<tr>");
php_info_printf("<td>");
@@ -200,7 +196,24 @@
php_info_printf("\n");
}
}
- return 0;
+}
+/* }}}*/
+
+static int _display_module_info_func(zend_module_entry *module TSRMLS_DC) /* {{{ */
+{
+ if (module->info_func) {
+ php_info_print_module(module TSRMLS_CC);
+ }
+ return ZEND_HASH_APPLY_KEEP;
+}
+/* }}} */
+
+static int _display_module_info_def(zend_module_entry *module TSRMLS_DC) /* {{{ */
+{
+ if (!module->info_func) {
+ php_info_print_module(module TSRMLS_CC);
+ }
+ return ZEND_HASH_APPLY_KEEP;
}
/* }}} */
@@ -607,22 +620,19 @@
}
if (flag & PHP_INFO_MODULES) {
- int show_info_func;
HashTable sorted_registry;
zend_module_entry tmp;
- zend_hash_init(&sorted_registry, 50, NULL, NULL, 1);
+ zend_hash_init(&sorted_registry, zend_hash_num_elements(&module_registry), NULL, NULL,
1);
zend_hash_copy(&sorted_registry, &module_registry, NULL, &tmp,
sizeof(zend_module_entry));
zend_hash_sort(&sorted_registry, zend_qsort, module_name_cmp, 0 TSRMLS_CC);
- show_info_func = 1;
- zend_hash_apply_with_argument(&sorted_registry, (apply_func_arg_t) _display_module_info,
&show_info_func TSRMLS_CC);
+ zend_hash_apply(&sorted_registry, (apply_func_t) _display_module_info_func TSRMLS_CC);
SECTION("Additional Modules");
php_info_print_table_start();
php_info_print_table_header(1, "Module Name");
- show_info_func = 0;
- zend_hash_apply_with_argument(&sorted_registry, (apply_func_arg_t) _display_module_info,
&show_info_func TSRMLS_CC);
+ zend_hash_apply(&sorted_registry, (apply_func_t) _display_module_info_def TSRMLS_CC);
php_info_print_table_end();
zend_hash_destroy(&sorted_registry);
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/info.h?r1=1.42&r2=1.43&diff_format=u
Index: php-src/ext/standard/info.h
diff -u php-src/ext/standard/info.h:1.42 php-src/ext/standard/info.h:1.43
--- php-src/ext/standard/info.h:1.42 Mon Jan 1 09:29:32 2007
+++ php-src/ext/standard/info.h Tue Jan 23 19:58:45 2007
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: info.h,v 1.42 2007/01/01 09:29:32 sebastian Exp $ */
+/* $Id: info.h,v 1.43 2007/01/23 19:58:45 helly Exp $ */
#ifndef INFO_H
#define INFO_H
@@ -81,6 +81,7 @@
PHPAPI void php_info_print_box_start(int bg);
PHPAPI void php_info_print_box_end(void);
PHPAPI void php_info_print_hr(void);
+PHPAPI void php_info_print_module(zend_module_entry *module TSRMLS_DC);
PHPAPI char *php_logo_guid(void);
PHPAPI char *php_get_uname(char mode);