1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Avoid double sorting of the symbol objects (first by name, then by

address).  The API contract for symbol doesn't indicate any sort order
on its returned array.
This commit is contained in:
Thomas Fletcher 2006-03-23 06:54:22 +00:00
parent 5085988731
commit f5c06ae811
4 changed files with 0 additions and 73 deletions

View file

@ -12,7 +12,6 @@ package org.eclipse.cdt.utils.elf;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Vector;
/**
@ -144,7 +143,6 @@ public class ElfHelper {
}
Elf.Symbol[] ret = (Elf.Symbol[])v.toArray(new Elf.Symbol[v.size()]);
Arrays.sort(ret, new SymbolSortCompare());
return ret;
}
@ -168,7 +166,6 @@ public class ElfHelper {
}
Elf.Symbol[] ret = (Elf.Symbol[])v.toArray(new Elf.Symbol[v.size()]);
Arrays.sort(ret, new SymbolSortCompare());
return ret;
}
@ -183,7 +180,6 @@ public class ElfHelper {
}
Elf.Symbol[] ret = (Elf.Symbol[])v.toArray(new Elf.Symbol[v.size()]);
Arrays.sort(ret, new SymbolSortCompare());
return ret;
}
@ -207,7 +203,6 @@ public class ElfHelper {
}
Elf.Symbol[] ret = (Elf.Symbol[])v.toArray(new Elf.Symbol[v.size()]);
Arrays.sort(ret, new SymbolSortCompare());
return ret;
}
@ -231,7 +226,6 @@ public class ElfHelper {
}
Elf.Symbol[] ret = (Elf.Symbol[])v.toArray(new Elf.Symbol[v.size()]);
Arrays.sort(ret, new SymbolSortCompare());
return ret;
}
@ -251,7 +245,6 @@ public class ElfHelper {
}
Elf.Symbol[] ret = (Elf.Symbol[])v.toArray(new Elf.Symbol[v.size()]);
Arrays.sort(ret, new SymbolSortCompare());
return ret;
}

View file

@ -1,30 +0,0 @@
/*******************************************************************************
* Copyright (c) 2000, 2004 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.utils.elf;
import java.util.Comparator;
public class SymbolSortCompare implements Comparator {
public int compare( Object o1, Object o2 ) {
String s1 = o1.toString();
String s2 = o2.toString();
while( s1.length() > 0 && s1.charAt( 0 ) == '_' )
s1 = s1.substring( 1 );
while( s2.length() > 0 && s2.charAt( 0 ) == '_' )
s2 = s2.substring( 1 );
return s1.compareToIgnoreCase( s2 );
}
}

View file

@ -125,7 +125,6 @@ public class MachOHelper {
}
MachO.Symbol[] ret = (MachO.Symbol[]) v.toArray(new MachO.Symbol[0]);
Arrays.sort(ret, new SymbolSortCompare());
return ret;
}
@ -146,7 +145,6 @@ public class MachOHelper {
}
MachO.Symbol[] ret = (MachO.Symbol[]) v.toArray(new MachO.Symbol[0]);
Arrays.sort(ret, new SymbolSortCompare());
return ret;
}
@ -161,7 +159,6 @@ public class MachOHelper {
}
MachO.Symbol[] ret = (MachO.Symbol[]) v.toArray(new MachO.Symbol[0]);
Arrays.sort(ret, new SymbolSortCompare());
return ret;
}
@ -185,7 +182,6 @@ public class MachOHelper {
}
MachO.Symbol[] ret = (MachO.Symbol[]) v.toArray(new MachO.Symbol[0]);
Arrays.sort(ret, new SymbolSortCompare());
return ret;
}
@ -209,7 +205,6 @@ public class MachOHelper {
}
MachO.Symbol[] ret = (MachO.Symbol[]) v.toArray(new MachO.Symbol[0]);
Arrays.sort(ret, new SymbolSortCompare());
return ret;
}
@ -228,7 +223,6 @@ public class MachOHelper {
}
MachO.Symbol[] ret = (MachO.Symbol[]) v.toArray(new MachO.Symbol[0]);
Arrays.sort(ret, new SymbolSortCompare());
return ret;
}

View file

@ -1,30 +0,0 @@
/*******************************************************************************
* Copyright (c) 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.utils.macho;
import java.util.Comparator;
public class SymbolSortCompare implements Comparator {
public int compare( Object o1, Object o2 ) {
String s1 = o1.toString();
String s2 = o2.toString();
while( s1.length() > 0 && s1.charAt( 0 ) == '_' )
s1 = s1.substring( 1 );
while( s2.length() > 0 && s2.charAt( 0 ) == '_' )
s2 = s2.substring( 1 );
return s1.compareToIgnoreCase( s2 );
}
}