[mythtv-commits] Ticket #4823: connections variable is useless

MythTV mythtv at cvs.mythtv.org
Mon Mar 3 16:33:10 UTC 2008


#4823: connections variable is useless
---------------------------------------------+------------------------------
 Reporter:  Erik Hovland <erik at hovland.org>  |       Owner:  ijr       
     Type:  defect                           |      Status:  new       
 Priority:  minor                            |   Milestone:  0.21      
Component:  mythtv                           |     Version:  0.21-fixes
 Severity:  low                              |     Mlocked:  0         
---------------------------------------------+------------------------------
 In the member function MythContext::PromptForSchemaUpgrade() the bool
 variable 'connections' is useless. So having it there only makes the code
 more confusing then it should.

 I am submitting a patch which comments it out and any code which uses it
 is changed or removed depending on that change.

 This one is a little tricky so forgive the longer description.

 First off, connections is never changed by any code. So it is always
 false. That means that whenever it is used, its evaluation is
 predetermined. At line 3511, the conditional will always have a true value
 for the connections test. So the only values that matter are autoUpgrade
 and upgradable. At line 3518, connections will always evaluate false, so
 this if can never happen. Even if you remove connections from the
 conditional, because of the conditional at 3511, this conditional cannot
 be true. So it is a code path that can never be traversed (even if
 connections is removed from it). Finally there is some code that uses
 connections as a conditional that doesn't mean anything. They can safely
 be removed.

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/4823>
MythTV <http://svn.mythtv.org/trac>
MythTV


More information about the mythtv-commits mailing list