diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-28 15:13:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-29 07:17:37 +0100 |
commit | 21de55596c0fdc2be736c6d0369bd9d3783020be (patch) | |
tree | 07d0f0cd54690e54405fe574c572cb2be74a3336 /basctl/source/basicide | |
parent | da9fb5d6d9ebf9363981c370ce937d8848989fcb (diff) |
remove unnecessary "if (!empty()" checks before loops
found with
git grep -n -A4 'if.*!.*empty' | grep -B3 -P
'(\bfor)|(\bwhile)|(\bdo)'
Change-Id: I582235b7cf977a0f9fb4099eb306fdb4a07b5334
Reviewed-on: https://gerrit.libreoffice.org/64169
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basctl/source/basicide')
-rw-r--r-- | basctl/source/basicide/bastype3.cxx | 95 |
1 files changed, 46 insertions, 49 deletions
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx index 90bbcbe44e83..c8f9506014ad 100644 --- a/basctl/source/basicide/bastype3.cxx +++ b/basctl/source/basicide/bastype3.cxx @@ -486,60 +486,57 @@ EntryDescriptor TreeListBox::GetEntryDescriptor( SvTreeListEntry* pEntry ) pEntry = GetParent( pEntry ); } - if ( !aEntries.empty() ) + for (SvTreeListEntry* pLE : aEntries) { - for (SvTreeListEntry* pLE : aEntries) - { - assert(pLE && "Entry not found in array"); - Entry* pBE = static_cast<Entry*>(pLE->GetUserData()); - assert(pBE && "No data found in entry!"); + assert(pLE && "Entry not found in array"); + Entry* pBE = static_cast<Entry*>(pLE->GetUserData()); + assert(pBE && "No data found in entry!"); - switch ( pBE->GetType() ) + switch ( pBE->GetType() ) + { + case OBJ_TYPE_LIBRARY: { - case OBJ_TYPE_LIBRARY: - { - aLibName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - case OBJ_TYPE_MODULE: - { - aName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - case OBJ_TYPE_METHOD: - { - aMethodName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - case OBJ_TYPE_DIALOG: - { - aName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - case OBJ_TYPE_DOCUMENT_OBJECTS: - case OBJ_TYPE_USERFORMS: - case OBJ_TYPE_NORMAL_MODULES: - case OBJ_TYPE_CLASS_MODULES: - { - aLibSubName = GetEntryText( pLE ); - eType = pBE->GetType(); - } - break; - default: - { - OSL_FAIL( "GetEntryDescriptor: unknown type" ); - eType = OBJ_TYPE_UNKNOWN; - } - break; + aLibName = GetEntryText( pLE ); + eType = pBE->GetType(); } - - if ( eType == OBJ_TYPE_UNKNOWN ) - break; + break; + case OBJ_TYPE_MODULE: + { + aName = GetEntryText( pLE ); + eType = pBE->GetType(); + } + break; + case OBJ_TYPE_METHOD: + { + aMethodName = GetEntryText( pLE ); + eType = pBE->GetType(); + } + break; + case OBJ_TYPE_DIALOG: + { + aName = GetEntryText( pLE ); + eType = pBE->GetType(); + } + break; + case OBJ_TYPE_DOCUMENT_OBJECTS: + case OBJ_TYPE_USERFORMS: + case OBJ_TYPE_NORMAL_MODULES: + case OBJ_TYPE_CLASS_MODULES: + { + aLibSubName = GetEntryText( pLE ); + eType = pBE->GetType(); + } + break; + default: + { + OSL_FAIL( "GetEntryDescriptor: unknown type" ); + eType = OBJ_TYPE_UNKNOWN; + } + break; } + + if ( eType == OBJ_TYPE_UNKNOWN ) + break; } return EntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType ); |