| 75 | } |
| 76 | |
| 77 | S32 ModuleManager::moduleDependencySort(ModuleDefinition* const* a, ModuleDefinition* const* b) |
| 78 | { |
| 79 | // if A depends on B move A down the list |
| 80 | ModuleDefinition::typeModuleDependencyVector moduleDependencies = (*a)->getDependencies(); |
| 81 | for (ModuleDefinition::typeModuleDependencyVector::const_iterator dependencyItr = moduleDependencies.begin(); dependencyItr != moduleDependencies.end(); ++dependencyItr) |
| 82 | { |
| 83 | if ((String::compare(dependencyItr->mModuleId, (*b)->getModuleId()) == 0) |
| 84 | && (dependencyItr->mVersionId == (*b)->getVersionId())) |
| 85 | return 1; |
| 86 | } |
| 87 | |
| 88 | //If B depends on A, move A up the list |
| 89 | ModuleDefinition::typeModuleDependencyVector moduleDependencies2 = (*b)->getDependencies(); |
| 90 | for (ModuleDefinition::typeModuleDependencyVector::const_iterator dependencyItr2 = moduleDependencies2.begin(); dependencyItr2 != moduleDependencies2.end(); ++dependencyItr2) |
| 91 | { |
| 92 | if ((String::compare(dependencyItr2->mModuleId, (*a)->getModuleId()) == 0) |
| 93 | && (dependencyItr2->mVersionId == (*a)->getVersionId())) |
| 94 | return -1; |
| 95 | } |
| 96 | //didn't find any explicit dependencies between the two, so sort by which has more |
| 97 | if (moduleDependencies.size() > moduleDependencies2.size()) return 1; |
| 98 | if (moduleDependencies.size() < moduleDependencies2.size()) return -1; |
| 99 | return 0; |
| 100 | } |
| 101 | |
| 102 | //----------------------------------------------------------------------------- |
| 103 |
nothing calls this directly
no test coverage detected