]> granicus.if.org Git - php/commitdiff
MFH
authorAndrei Zmievski <andrei@php.net>
Thu, 14 Nov 2002 21:17:00 +0000 (21:17 +0000)
committerAndrei Zmievski <andrei@php.net>
Thu, 14 Nov 2002 21:17:00 +0000 (21:17 +0000)
ext/standard/info.c

index 294e48e8cbf48eb64dc2db8b0c629c3c230e8bec..33aa326ca5edb4f48ca77db3281b14f7fc1e9a6c 100644 (file)
@@ -326,6 +326,16 @@ PHPAPI void php_print_info_htmlhead(TSRMLS_D)
 }
 /* }}} */
 
+/* {{{ module_name_cmp */
+static int module_name_cmp(const void *a, const void *b TSRMLS_DC)
+{
+       Bucket *f = *((Bucket **) a);
+       Bucket *s = *((Bucket **) b);
+
+       return strcmp(((zend_module_entry *)f->pData)->name,
+                                 ((zend_module_entry *)s->pData)->name);
+}
+/* }}} */
 
 /* {{{ php_print_info
  */
@@ -497,16 +507,24 @@ PHPAPI void php_print_info(int flag TSRMLS_DC)
 
        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_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(&module_registry, (apply_func_arg_t) _display_module_info, &show_info_func TSRMLS_CC);
+               zend_hash_apply_with_argument(&sorted_registry, (apply_func_arg_t) _display_module_info, &show_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(&module_registry, (apply_func_arg_t) _display_module_info, &show_info_func TSRMLS_CC);
+               zend_hash_apply_with_argument(&sorted_registry, (apply_func_arg_t) _display_module_info, &show_info_func TSRMLS_CC);
                php_info_print_table_end();
+
+               zend_hash_destroy(&sorted_registry);
        }
 
        if (flag & PHP_INFO_ENVIRONMENT) {