martin 98/08/29 11:27:11
Modified: src/modules/standard mod_autoindex.c
Log:
Make configuration parsing for IconWidth/Height somewhat easier and
more robust. Previously, the IconWidth/IconHeight directives were
not checked correctly (e.g., IconWidthFailsToDetectThis=10 would
be parsed as a legal IconWidth=10 option). Also, copying the argument and
parsing it with ap_getword() seems to be a waste of computing time.
Revision Changes Path
1.89 +10 -22 apache-1.3/src/modules/standard/mod_autoindex.c
Index: mod_autoindex.c
===================================================================
RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_autoindex.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- mod_autoindex.c 1998/08/22 06:57:17 1.88
+++ mod_autoindex.c 1998/08/29 18:27:10 1.89
@@ -319,29 +319,17 @@
else if (!strcasecmp(w, "None")) {
opts = 0;
}
- else if (!strncasecmp(w, "IconWidth", 9)) {
- if (strchr(w, '=') != NULL) {
- const char *x = ap_pstrdup(cmd->pool, w);
- char *val;
- val = ap_getword(cmd->pool, &x, '=');
- val = ap_getword(cmd->pool, &x, '=');
- d_cfg->icon_width = atoi(val);
- }
- else {
- d_cfg->icon_width = DEFAULT_ICON_WIDTH;
- }
+ else if (!strcasecmp(w, "IconWidth")) {
+ d_cfg->icon_width = DEFAULT_ICON_WIDTH;
}
- else if (!strncasecmp(w, "IconHeight", 10)) {
- if (strchr(w, '=') != NULL) {
- const char *x = ap_pstrdup(cmd->pool, w);
- char *val;
- val = ap_getword(cmd->pool, &x, '=');
- val = ap_getword(cmd->pool, &x, '=');
- d_cfg->icon_height = atoi(val);
- }
- else {
- d_cfg->icon_height = DEFAULT_ICON_HEIGHT;
- }
+ else if (!strncasecmp(w, "IconWidth=", 10)) {
+ d_cfg->icon_width = atoi(&w[10]);
+ }
+ else if (!strcasecmp(w, "IconHeight")) {
+ d_cfg->icon_height = DEFAULT_ICON_HEIGHT;
+ }
+ else if (!strncasecmp(w, "IconHeight=", 11)) {
+ d_cfg->icon_height = atoi(&w[11]);
}
else {
return "Invalid directory indexing option";