aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEtienne Bergeron2013-12-10 10:32:40 (EST)
committerMatthew Khouzam2013-12-11 10:59:33 (EST)
commitfc9d8c3290b28f27fdf26b4a6846411ab3a4704d (patch)
tree5675eb6f65722b9bb56aee4bf73926887c71114a
parent8ff9bdc537dd6270936e86f1412f772a568e8abf (diff)
downloadorg.eclipse.linuxtools-fc9d8c3290b28f27fdf26b4a6846411ab3a4704d.zip
org.eclipse.linuxtools-fc9d8c3290b28f27fdf26b4a6846411ab3a4704d.tar.gz
org.eclipse.linuxtools-fc9d8c3290b28f27fdf26b4a6846411ab3a4704d.tar.bz2
ctf: avoid array creation to iterate through scope types.refs/changes/91/19591/2
The array creation is useless in this case. It come from the exposed API of the scope which expose an "Array" instead of an "Set". The collection is not important to iterate through. Change-Id: Ica313c1cbb4d58529389fe15dfd71f153a11b00b Signed-off-by: Etienne Bergeron <etienne.bergeron@gmail.com> Reviewed-on: https://git.eclipse.org/r/19591 Tested-by: Hudson CI Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/DeclarationScope.java14
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/IOStructGen.java3
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/MetadataStrings.java4
3 files changed, 10 insertions, 11 deletions
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/DeclarationScope.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/DeclarationScope.java
index 68c1568..b399f9c 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/DeclarationScope.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/DeclarationScope.java
@@ -14,6 +14,7 @@ package org.eclipse.linuxtools.internal.ctf.core.event.metadata;
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
import org.eclipse.linuxtools.ctf.core.event.types.EnumDeclaration;
import org.eclipse.linuxtools.ctf.core.event.types.IDeclaration;
@@ -270,7 +271,7 @@ class DeclarationScope {
}
/**
- * Looks up a enum declaration.
+ * Looks up an enum declaration.
*
* @param name
* The name of the enum to search for.
@@ -334,7 +335,7 @@ class DeclarationScope {
}
/**
- * Looks through the list of identifiers of a scope to find if it exists.
+ * Lookup query for an identifier in this scope.
*
* @param identifier
* the name of the identifier to search for. In the case of int
@@ -346,8 +347,8 @@ class DeclarationScope {
}
/**
- * Recursively looks through the list of identifiers of a scope to find if
- * it exists.
+ * Lookup query for an identifier through this scope and its ancestors.
+ * An ancestor scope is a scope in which this scope is nested.
*
* @param identifier
* the name of the identifier to search for. In the case of int
@@ -369,9 +370,8 @@ class DeclarationScope {
*
* @return The type names
*/
- public String[] getTypeNames() {
- String[] keys = new String[types.keySet().size()];
- return types.keySet().toArray(keys);
+ public Set<String> getTypeNames() {
+ return types.keySet();
}
/**
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/IOStructGen.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/IOStructGen.java
index 195ac07..5ca358a 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/IOStructGen.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/IOStructGen.java
@@ -428,9 +428,8 @@ public class IOStructGen {
} else {
trace.setByteOrder(byteOrder);
final DeclarationScope parentScope = scope.getParentScope();
- String types[] = parentScope.getTypeNames();
- for (String type : types) {
+ for (String type : parentScope.getTypeNames()) {
IDeclaration d = parentScope.lookupType(type);
if (d instanceof IntegerDeclaration) {
addByteOrder(byteOrder, parentScope, type, (IntegerDeclaration) d);
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/MetadataStrings.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/MetadataStrings.java
index 0852f0b..40ae015 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/MetadataStrings.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/MetadataStrings.java
@@ -103,9 +103,9 @@ public interface MetadataStrings {
static final String TRUE2 = "TRUE";
/** True */
static final String TRUE = "true";
- /** Minor (Vresion)*/
+ /** Minor (Version)*/
static final String MINOR = "minor";
- /** Major (Vresion)*/
+ /** Major (Version)*/
static final String MAJOR = "major";
}