mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
bug 279844: Slow algorithm for checking duplicate path entries
Patch from David Dubrow
This commit is contained in:
parent
e69c7e2846
commit
c3704262e9
2 changed files with 23 additions and 12 deletions
|
@ -92,6 +92,18 @@ public final class CLibraryFileEntry extends ACPathEntry implements
|
|||
return fSourceAttachmentRootPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((fSourceAttachmentPath == null) ? 0 : fSourceAttachmentPath.hashCode());
|
||||
result = prime * result
|
||||
+ ((fSourceAttachmentPrefixMapping == null) ? 0 : fSourceAttachmentPrefixMapping.hashCode());
|
||||
result = prime * result
|
||||
+ ((fSourceAttachmentRootPath == null) ? 0 : fSourceAttachmentRootPath.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if(other == this)
|
||||
|
|
|
@ -1793,15 +1793,16 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
|||
newEntries = EMPTY_LANGUAGE_SETTINGS_ENTRIES_ARRAY;
|
||||
}
|
||||
|
||||
Set<ICLanguageSettingEntry> newEntrySet = new HashSet<ICLanguageSettingEntry>(Arrays.asList(newEntries));
|
||||
Set<ICLanguageSettingEntry> oldEntrySet = new HashSet<ICLanguageSettingEntry>(Arrays.asList(oldEntries));
|
||||
|
||||
// Check the removed entries.
|
||||
for (int i = 0; i < oldEntries.length; i++) {
|
||||
for (ICLanguageSettingEntry oldEntry : oldEntries) {
|
||||
boolean found = false;
|
||||
for (int j = 0; j < newEntries.length; j++) {
|
||||
if (oldEntries[i].equals(newEntries[j])) {
|
||||
if (newEntrySet.contains(oldEntry)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found){
|
||||
result[1] = true;
|
||||
break;
|
||||
|
@ -1809,14 +1810,12 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
|||
}
|
||||
|
||||
// Check the new entries.
|
||||
for (int i = 0; i < newEntries.length; i++) {
|
||||
for (ICLanguageSettingEntry newEntry : newEntries) {
|
||||
boolean found = false;
|
||||
for (int j = 0; j < oldEntries.length; j++) {
|
||||
if (newEntries[i].equals(oldEntries[j])) {
|
||||
if (oldEntrySet.contains(newEntry)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!found){
|
||||
result[0] = true;
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue