You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2011/12/30 12:03:18 UTC
svn commit: r1225801 - in /httpd/httpd/branches/2.4.x: ./
modules/generators/mod_info.c
Author: sf
Date: Fri Dec 30 11:03:17 2011
New Revision: 1225801
URL: http://svn.apache.org/viewvc?rev=1225801&view=rev
Log:
merge r1225796:
Sort list of modules
Modified:
httpd/httpd/branches/2.4.x/ (props changed)
httpd/httpd/branches/2.4.x/modules/generators/mod_info.c
Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Dec 30 11:03:17 2011
@@ -1,3 +1,3 @@
/httpd/httpd/branches/revert-ap-ldap:1150158-1150173
/httpd/httpd/branches/wombat-integration:723609-723841
-/httpd/httpd/trunk:1201042,1201111,1201194,1201198,1201202,1202236,1202456,1202886,1203859,1204630,1204968,1204990,1205061,1205075,1205379,1205885,1206291,1206587,1206850,1207719,1208753,1208835,1209053,1209085,1209417,1209432,1209461,1209601,1209603,1209618,1209623,1209741,1209754,1209766,1209776,1209797-1209798,1209811-1209812,1209814,1209908,1209910,1209913,1209916-1209917,1209947,1209952,1210080,1210124,1210130,1210219,1210221,1210252,1210284,1210378,1210725,1210892,1210951,1210954,1211528,1211663,1211680,1212883,1213338,1213567,1214003,1214005,1214015,1220462,1220467,1220493,1220524,1220570,1220768,1220794,1220826,1220846,1221292,1222335,1222370,1222473,1222915,1222917,1222921,1223048,1225060,1225197-1225198,1225380,1225476,1225478,1225791,1225795
+/httpd/httpd/trunk:1201042,1201111,1201194,1201198,1201202,1202236,1202456,1202886,1203859,1204630,1204968,1204990,1205061,1205075,1205379,1205885,1206291,1206587,1206850,1207719,1208753,1208835,1209053,1209085,1209417,1209432,1209461,1209601,1209603,1209618,1209623,1209741,1209754,1209766,1209776,1209797-1209798,1209811-1209812,1209814,1209908,1209910,1209913,1209916-1209917,1209947,1209952,1210080,1210124,1210130,1210219,1210221,1210252,1210284,1210378,1210725,1210892,1210951,1210954,1211528,1211663,1211680,1212883,1213338,1213567,1214003,1214005,1214015,1220462,1220467,1220493,1220524,1220570,1220768,1220794,1220826,1220846,1221292,1222335,1222370,1222473,1222915,1222917,1222921,1223048,1225060,1225197-1225198,1225380,1225476,1225478,1225791,1225795-1225796
Modified: httpd/httpd/branches/2.4.x/modules/generators/mod_info.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/generators/mod_info.c?rev=1225801&r1=1225800&r2=1225801&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/generators/mod_info.c (original)
+++ httpd/httpd/branches/2.4.x/modules/generators/mod_info.c Fri Dec 30 11:03:17 2011
@@ -63,6 +63,7 @@
#include "ap_mpm.h"
#include "mpm_common.h"
#include <stdio.h>
+#include <stdlib.h>
typedef struct
{
@@ -687,11 +688,32 @@ static int show_active_hooks(request_rec
return 0;
}
+static int cmp_module_name(const void *a_, const void *b_)
+{
+ const module * const *a = a_;
+ const module * const *b = b_;
+ return strcmp((*a)->name, (*b)->name);
+}
+
+static apr_array_header_t *get_sorted_modules(apr_pool_t *p)
+{
+ apr_array_header_t *arr = apr_array_make(p, 64, sizeof(module *));
+ module *modp, **entry;
+ for (modp = ap_top_module; modp; modp = modp->next) {
+ entry = &APR_ARRAY_PUSH(arr, module *);
+ *entry = modp;
+ }
+ qsort(arr->elts, arr->nelts, sizeof(module *), cmp_module_name);
+ return arr;
+}
+
static int display_info(request_rec * r)
{
- module *modp;
+ module *modp = NULL;
const char *more_info;
const command_rec *cmd;
+ apr_array_header_t *modules = NULL;
+ int i;
if (strcmp(r->handler, "server-info")) {
return DECLINED;
@@ -730,11 +752,12 @@ static int display_info(request_rec * r)
ap_rputs("<h2><a name=\"modules\">Loaded Modules</a></h2>"
"<dl><dt><tt>", r);
- /* TODO: Sort by Alpha */
- for (modp = ap_top_module; modp; modp = modp->next) {
+ modules = get_sorted_modules(r->pool);
+ for (i = 0; i < modules->nelts; i++) {
+ modp = APR_ARRAY_IDX(modules, i, module *);
ap_rprintf(r, "<a href=\"#%s\">%s</a>", modp->name,
modp->name);
- if (modp->next) {
+ if (i < modules->nelts) {
ap_rputs(", ", r);
}
}
@@ -756,7 +779,10 @@ static int display_info(request_rec * r)
}
else {
int comma = 0;
- for (modp = ap_top_module; modp; modp = modp->next) {
+ if (!modules)
+ modules = get_sorted_modules(r->pool);
+ for (i = 0; i < modules->nelts; i++) {
+ modp = APR_ARRAY_IDX(modules, i, module *);
if (!r->args || !strcasecmp(modp->name, r->args)) {
ap_rprintf(r,
"<dl><dt><a name=\"%s\"><strong>Module Name:</strong></a> "
@@ -862,7 +888,9 @@ static int display_info(request_rec * r)
}
else {
ap_rputs("<dl><dt>Server Module List</dt>", r);
- for (modp = ap_top_module; modp; modp = modp->next) {
+ modules = get_sorted_modules(r->pool);
+ for (i = 0; i < modules->nelts; i++) {
+ modp = APR_ARRAY_IDX(modules, i, module *);
ap_rputs("<dd>", r);
ap_rputs(modp->name, r);
ap_rputs("</dd>", r);