Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/gcov
diff options
context:
space:
mode:
authorAlexander Kurtakov2013-12-16 13:30:32 +0000
committerAlexander Kurtakov2013-12-16 14:06:05 +0000
commit5c0e3a07b8a1eba63a5d90e3ad5a4115f15f981f (patch)
tree9ba716e04cf381b5b5e7ce3ef47b813ce4eb19de /gcov
parent923605d51b211f56f2b48e919950aaa8a778a36c (diff)
downloadorg.eclipse.linuxtools-5c0e3a07b8a1eba63a5d90e3ad5a4115f15f981f.tar.gz
org.eclipse.linuxtools-5c0e3a07b8a1eba63a5d90e3ad5a4115f15f981f.tar.xz
org.eclipse.linuxtools-5c0e3a07b8a1eba63a5d90e3ad5a4115f15f981f.zip
gcov: Various cosmetics.
* Foreach * {} around blocks * String.isEmpty. Change-Id: I03f79e80accd7aa7590c8dfc3eb3e4f5f2a22780 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com> Reviewed-on: https://git.eclipse.org/r/19854 Tested-by: Hudson CI
Diffstat (limited to 'gcov')
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java14
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Folder.java8
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoFunction.java18
-rw-r--r--gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/SourceFile.java8
4 files changed, 28 insertions, 20 deletions
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java
index f005802c93..a8a91b3fff 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/CovManager.java
@@ -258,9 +258,11 @@ public class CovManager implements Serializable {
String postfix = ""; //$NON-NLS-1$
File dir = null;
do {
- if ("".equals(postfix))postfix = f.getName(); //$NON-NLS-1$
- else
- postfix = f.getName() + File.separator + postfix;
+ if (postfix.isEmpty()) {
+ postfix = f.getName();
+ } else {
+ postfix = f.getName() + File.separator + postfix;
+ }
f = f.getParentFile();
if (f != null) {
dir = sourcePath.get(f);
@@ -281,9 +283,9 @@ public class CovManager implements Serializable {
fg.setFileName(filename);
fg.setText(NLS.bind(Messages.CovManager_No_FilePath_Error, new Object[] { filePath, filename }));
String s = fg.open();
- if (s == null)
- return null;
- else {
+ if (s == null) {
+ return null;
+ } else {
f = new File(s).getAbsoluteFile();
addSourceLookup(sourcePath, f, new File(filePath).getAbsoluteFile());
if (f.isFile() && f.canRead()) {
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Folder.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Folder.java
index 75832930e7..65f3d244ae 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Folder.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/Folder.java
@@ -34,10 +34,10 @@ public class Folder implements Serializable {
public void accumulateSourcesCounts(){
- for (int i = 0; i < srcFiles.size(); i++) {
- numLines += (srcFiles.get(i)).getNumLines();
- linesInstrumented += (srcFiles.get(i)).getLinesInstrumented();
- linesExecuted += (srcFiles.get(i)).getLinesExecuted();
+ for (SourceFile srcFile: srcFiles) {
+ numLines += srcFile.getNumLines();
+ linesInstrumented += srcFile.getLinesInstrumented();
+ linesExecuted += srcFile.getLinesExecuted();
}
}
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoFunction.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoFunction.java
index 88c118f816..54c139c5a7 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoFunction.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/GcnoFunction.java
@@ -88,8 +88,7 @@ public class GcnoFunction implements Serializable, Comparable<GcnoFunction> {
fnctnBlcks.get(fnctnBlcks.size() - 1).setNumSuccs(50000);
}
- for (int i = 0; i < fnctnBlcks.size(); i++) {
- Block b = fnctnBlcks.get(i);
+ for (Block b: fnctnBlcks) {
b.setInvalidChain(true);
invalidBlocks.add(b);
}
@@ -105,14 +104,17 @@ public class GcnoFunction implements Serializable, Comparable<GcnoFunction> {
if (invb.getNumSuccs() == 0) {
ArrayList<Arc> extArcs = invb.getExitArcs();
- for (Arc arc : extArcs)
+ for (Arc arc : extArcs) {
total += arc.getCount();
+ }
} else if (invb.getNumPreds() == 0) {
ArrayList<Arc> entrArcs = invb.getEntryArcs();
- for (Arc arc : entrArcs)
+ for (Arc arc : entrArcs) {
total += arc.getCount();
- } else
+ }
+ } else {
continue;
+ }
invb.setCount(total);
invb.setCountValid(true);
@@ -137,8 +139,9 @@ public class GcnoFunction implements Serializable, Comparable<GcnoFunction> {
for (Arc extAr : vb.getExitArcs()) {
total -= extAr.getCount();
- if (extAr.isCountValid() == false)
+ if (extAr.isCountValid() == false) {
invarc = extAr;
+ }
}
blcksdst = invarc.getDstnatnBlock();
invarc.setCountValid(true);
@@ -166,8 +169,9 @@ public class GcnoFunction implements Serializable, Comparable<GcnoFunction> {
for (Arc entrAr : vb.getEntryArcs()) {
total -= entrAr.getCount();
- if (entrAr.isCountValid() == false)
+ if (entrAr.isCountValid() == false) {
invarc = entrAr;
+ }
}
blcksrc = invarc.getSrcBlock();
diff --git a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/SourceFile.java b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/SourceFile.java
index cdf19fd88b..8544a5ca12 100644
--- a/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/SourceFile.java
+++ b/gcov/org.eclipse.linuxtools.gcov.core/src/org/eclipse/linuxtools/internal/gcov/parser/SourceFile.java
@@ -42,8 +42,9 @@ public class SourceFile implements Serializable {
for (Line line : lines) {
if (line.exists()) {
cvrge.incLinesInstrumented();
- if (line.getCount() != 0)
+ if (line.getCount() != 0) {
cvrge.incLinesExecuted();
+ }
}
}
}
@@ -51,8 +52,9 @@ public class SourceFile implements Serializable {
public long getmaxLineCount() {
if (maxCount < 0) {
for (Line line : lines) {
- if (line.getCount() > maxCount)
+ if (line.getCount() > maxCount) {
maxCount = line.getCount();
+ }
}
}
return maxCount;
@@ -101,7 +103,7 @@ public class SourceFile implements Serializable {
public void createLines() {
int n = getNumLines();
lines.ensureCapacity(n);
- for (int j = 0; j<n ; j++) {
+ for (int j = 0; j < n; j++) {
lines.add(new Line());
}
}

Back to the top