Removed the package preloading.

Anything that might have depended on this is long gone and the only 
possible result of it now is more memory leaks.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2910 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
mcmartin
2008-01-21 00:43:02 +00:00
parent ca7212d789
commit 7293c26b96
+1 -23
View File
@@ -68,22 +68,6 @@ lookupResourceDesc (ResourceIndex *idx, RESOURCE res) {
return NULL;
}
// Load every resource in a package.
static void
loadPackage (ResourceIndex *idx, RES_PACKAGE pkg) {
COUNT i;
for (i = 0; i < idx->numRes; i++) {
if (GET_PACKAGE (idx->res[i]->res) != pkg)
continue;
if (idx->res[i]->resdata != NULL)
continue; // Already loaded
loadResourceDesc (idx, idx->res[i]);
}
}
void *
loadResourceDesc (ResourceIndex *idx, ResourceDesc *desc)
{
@@ -198,11 +182,6 @@ err:
}
// Get a resource by its resource ID.
// For historical reasons, if the resource is not already loaded,
// the *entire* package will be (pre-)loaded.
// NB. It may be better to add an extra flag to res_GetResource() to
// indicate whether you really want this, or add a separate function
// for preloading the entire package.
void *
res_GetResource (RESOURCE res)
{
@@ -222,8 +201,7 @@ res_GetResource (RESOURCE res)
if (desc->resdata != NULL)
return desc->resdata;
// Load the entire package, for historical reasons.
loadPackage (resourceIndex, GET_PACKAGE (res));
loadResourceDesc (resourceIndex, desc);
return desc->resdata;
// May still be NULL, if the load failed.