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:
@@ -68,22 +68,6 @@ lookupResourceDesc (ResourceIndex *idx, RESOURCE res) {
|
|||||||
return NULL;
|
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 *
|
void *
|
||||||
loadResourceDesc (ResourceIndex *idx, ResourceDesc *desc)
|
loadResourceDesc (ResourceIndex *idx, ResourceDesc *desc)
|
||||||
{
|
{
|
||||||
@@ -198,11 +182,6 @@ err:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get a resource by its resource ID.
|
// 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 *
|
void *
|
||||||
res_GetResource (RESOURCE res)
|
res_GetResource (RESOURCE res)
|
||||||
{
|
{
|
||||||
@@ -222,8 +201,7 @@ res_GetResource (RESOURCE res)
|
|||||||
if (desc->resdata != NULL)
|
if (desc->resdata != NULL)
|
||||||
return desc->resdata;
|
return desc->resdata;
|
||||||
|
|
||||||
// Load the entire package, for historical reasons.
|
loadResourceDesc (resourceIndex, desc);
|
||||||
loadPackage (resourceIndex, GET_PACKAGE (res));
|
|
||||||
|
|
||||||
return desc->resdata;
|
return desc->resdata;
|
||||||
// May still be NULL, if the load failed.
|
// May still be NULL, if the load failed.
|
||||||
|
|||||||
Reference in New Issue
Block a user