1997-10-12
1997-10-12 21:08:42 by Henrik Grubbström (Grubba) <grubba@grubba.org>
-
8cc31bf1efb3de07748048fc69e0977f644b4cd4
(44 lines)
(+30/-14)
[
Show
| Annotate
]
Branch: 5.2
Location modules are now sorted according to path.
Renamed unvalidate_cache to invalidate_cache.
Rev: server/base_server/configuration.pike:1.82
1:
- string cvs_version = "$Id: configuration.pike,v 1.81 1997/10/03 17:16:45 grubba Exp $";
+ string cvs_version = "$Id: configuration.pike,v 1.82 1997/10/12 21:08:42 grubba Exp $";
#include <module.h>
#include <roxen.h>
/* A configuration.. */
415:
if(!location_module_cache)
{
int i;
- location_module_cache=({ });
+ array new_location_module_cache=({ });
for(i=9; i>=0; i--)
{
object *d, p;
- if(d=pri[i]->location_modules)
- foreach(d, p)
- if(p->find_file && p->query_location())
- location_module_cache+=({({ p->query_location(),
- p->find_file })});
+ if(d=pri[i]->location_modules) {
+ array level_find_files = ({});
+ array level_locations = ({});
+ foreach(d, p) {
+ string location;
+ // FIXME: Should there be a catch() here?
+ if(p->find_file && (location = p->query_location())) {
+ level_find_files += ({ p->find_file });
+ level_locations += ({ location });
}
}
-
+ sort(level_locations, level_find_files);
+ int j;
+ for (j = sizeof(level_locations); j--;) {
+ // Order after longest path first.
+ new_location_module_cache += ({ ({ level_locations[j],
+ level_find_files[j] }) });
+ }
+ }
+ }
+ location_module_cache = new_location_module_cache;
+ }
return location_module_cache;
}
794:
}
#endif
// Empty all the caches above.
- void unvalidate_cache()
+ void invalidate_cache()
{
last_module_cache = 0;
filter_module_cache = 0;
1555:
}
}
}
- unvalidate_cache();
+ invalidate_cache();
}
// Save all variables in _one_ module.
1574:
{
store(mod->sname+"#0", o->query(), 0, this);
o->start(2, this);
- unvalidate_cache();
+ invalidate_cache();
return 1;
} else if(mod->copies) {
int i;
1584:
{
store(mod->sname+"#"+i, o->query(), 0, this);
o->start(2, this);
- unvalidate_cache();
+ invalidate_cache();
return 1;
}
}
1902: Inside #if defined(MODULE_DEBUG)
#ifdef MODULE_DEBUG
perror(" Done.\n");
#endif
- unvalidate_cache();
+ invalidate_cache();
return me;
}
return 0;
2084:
unload_module(modname);
}
- unvalidate_cache();
+ invalidate_cache();
if(!me)
{
2352:
perror(" Done ("+search(_master->programs,prog)+").\n");
#endif
cache_set("modules", module_file, modules[module_file]["program"]);
- // ?? unvalidate_cache();
+ // ?? invalidate_cache();
return 1;
}