diff options
author | Harvey Harrison <[email protected]> | 2013-07-01 08:13:05 -0700 |
---|---|---|
committer | Harvey Harrison <[email protected]> | 2013-07-01 08:13:05 -0700 |
commit | 1e7c0dd2a2772aa0b81ac24eafeb7348f7bd11bb (patch) | |
tree | 53e31ddf2e8651c8a1e51e02d7a1672b1f73e340 | |
parent | 9dc974b38188447a943c20511a6f9f6157552df9 (diff) |
j3dcore: declare some local varaibles next to where they are used
The compiler noticed the null check was always true at this point as nothing had written
to currTree. Declare it next to its only use making the code more obvious.
Signed-off-by: Harvey Harrison <[email protected]>
-rw-r--r-- | src/classes/share/javax/media/j3d/GeometryStructure.java | 48 |
1 files changed, 19 insertions, 29 deletions
diff --git a/src/classes/share/javax/media/j3d/GeometryStructure.java b/src/classes/share/javax/media/j3d/GeometryStructure.java index 84ffba0..48f2138 100644 --- a/src/classes/share/javax/media/j3d/GeometryStructure.java +++ b/src/classes/share/javax/media/j3d/GeometryStructure.java @@ -312,7 +312,6 @@ class GeometryStructure extends J3dStructure { private void insertNodes(Object[] nodes) { Object node; GeometryAtom geomAtom; - BHTree currTree = null; clearBhNodeArr(); @@ -352,28 +351,22 @@ class GeometryStructure extends J3dStructure { } // Look for the right BHTree to insert to. - if (currTree == null) { - // We must separate the following two calls - // since the first Call will allocate storage bhTreeArr - // for the second index operation. (see bug 4361998) - int idx = getOrAddBHTreeIndex(((BHLeafNode)bhNodeArr[0]).getLocale()); - currTree = bhTreeArr[idx]; - - } - + // We must separate the following two calls + // since the first Call will allocate storage bhTreeArr + // for the second index operation. (see bug 4361998) + int idx = getOrAddBHTreeIndex(((BHLeafNode)bhNodeArr[0]).getLocale()); + BHTree currTree = bhTreeArr[idx]; currTree.insert(bhNodeArr, bhNodeCount); - // Issue 353: must clear array after we are done with it - clearBhNodeArr(); + // Issue 353: must clear array after we are done with it + clearBhNodeArr(); // currTree.gatherTreeStatistics(); } void removeNodes(J3dMessage m) { Object[] nodes = (Object[]) m.args[0]; - BHTree currTree = null; Object node; - int index; clearBhNodeArr(); @@ -445,20 +438,17 @@ class GeometryStructure extends J3dStructure { return; } - if (currTree == null) { - index = getBHTreeIndex(((BHLeafNode)bhNodeArr[0]).getLocale()); - if (index<0) { - // Issue 353: must clear array after we are done with it - clearBhNodeArr(); - + int index = getBHTreeIndex(((BHLeafNode) bhNodeArr[0]).getLocale()); + if (index < 0) { + // Issue 353: must clear array after we are done with it + clearBhNodeArr(); return; - } - currTree = bhTreeArr[index]; } + BHTree currTree = bhTreeArr[index]; currTree.delete(bhNodeArr, bhNodeCount); - // Issue 353: must clear array after we are done with it - clearBhNodeArr(); + // Issue 353: must clear array after we are done with it + clearBhNodeArr(); // It is safe to do it here since only GeometryStructure // thread invoke wakeupOnCollisionEntry/Exit .toArray() @@ -1161,11 +1151,11 @@ class GeometryStructure extends J3dStructure { */ private void processSwitchChanged(J3dMessage m) { - int i; - UnorderList arrList; - int size, treeIndex; - Object[] nodes; - LeafRetained leaf; +// int i; +// UnorderList arrList; +// int size, treeIndex; +// Object[] nodes; +// LeafRetained leaf; /* is now a NOOP |