Fix possible (unlikely) use of uninitialized value.

Plus two minor refactors/nits.
This commit is contained in:
Jon Siwek 2013-09-16 15:36:18 -05:00
parent 735d2c402a
commit c8758c4f24

View file

@ -281,7 +281,7 @@ Val* BroFunc::Call(val_list* args, Frame* parent) const
#ifdef PROFILE_BRO_FUNCTIONS #ifdef PROFILE_BRO_FUNCTIONS
DEBUG_MSG("Function: %s\n", id->Name()); DEBUG_MSG("Function: %s\n", id->Name());
#endif #endif
if ( ! bodies.size() ) if ( bodies.empty() )
{ {
// Can only happen for events and hooks. // Can only happen for events and hooks.
assert(Flavor() == FUNC_FLAVOR_EVENT || Flavor() == FUNC_FLAVOR_HOOK); assert(Flavor() == FUNC_FLAVOR_EVENT || Flavor() == FUNC_FLAVOR_HOOK);
@ -315,14 +315,14 @@ Val* BroFunc::Call(val_list* args, Frame* parent) const
loop_over_list(*args, i) loop_over_list(*args, i)
f->SetElement(i, (*args)[i]); f->SetElement(i, (*args)[i]);
stmt_flow_type flow; stmt_flow_type flow = FLOW_NEXT;
Val* result = 0; Val* result = 0;
if ( sample_logger ) if ( sample_logger )
sample_logger->FunctionSeen(this); sample_logger->FunctionSeen(this);
for ( unsigned int i = 0; i < bodies.size(); ++i ) for ( size_t i = 0; i < bodies.size(); ++i )
{ {
if ( sample_logger ) if ( sample_logger )
sample_logger->LocationSeen( sample_logger->LocationSeen(