Revert part of r43092.

* Caching of CountItems() to avoid calling it at each loop iteration
 * Use of strcasecmp when comparing strings for exact equality
This commit is contained in:
Adrien Destugues - PulkoMandy 2012-03-03 22:44:35 +01:00
parent ef3aa6274d
commit 5e8f4256fe
3 changed files with 10 additions and 10 deletions

View File

@ -787,7 +787,7 @@ TExpandoMenuBar::monitor_team_windows(void* arg)
((1 << current_workspace())
& wInfo->workspaces) != 0);
if (strcasecmp(wInfo->name,
if (strcmp(wInfo->name,
item->FullTitle()) != 0)
item->SetLabel(wInfo->name);

View File

@ -116,7 +116,8 @@ TWindowMenu::AttachedToWindow()
int32 parentMenuItems = 0;
for (int32 i = 0; i < fTeam->CountItems(); i++) {
int32 teamCount = fTeam->CountItems();
for (int32 i = 0; i < teamCount; i++) {
team_id theTeam = (team_id)fTeam->ItemAt(i);
int32 tokenCount = 0;
int32* tokens = get_token_list(theTeam, &tokenCount);
@ -130,7 +131,11 @@ TWindowMenu::AttachedToWindow()
&& (wInfo->show_hide_level <= 0 || wInfo->is_mini)) {
// Don't add new items if we're expanded. We've already done
// this, they've just been moved.
for (int32 addIndex = 0; addIndex < CountItems(); addIndex++) {
int32 numItems = CountItems();
// Find first item that sorts alphabetically after this window,
// so we know where to put it
for (int32 addIndex = 0; addIndex < numItems; addIndex++) {
TWindowMenuItem* item
= static_cast<TWindowMenuItem*>(ItemAt(addIndex));
if (item != NULL

View File

@ -133,7 +133,7 @@ TWindowMenuItem::SetLabel(const char* string)
Frame().Width() - contLoc.x - 3.0f);
}
if (strcasecmp(Label(), truncatedTitle.String()) != 0)
if (strcmp(Label(), truncatedTitle.String()) != 0)
BMenuItem::SetLabel(truncatedTitle.String());
}
@ -149,18 +149,13 @@ TWindowMenuItem::FullTitle() const
TWindowMenuItem::InsertIndexFor(BMenu* menu, int32 startIndex,
TWindowMenuItem* newItem)
{
int32 index = 0;
for (index = startIndex;; index++) {
for (int32 index = startIndex;; index++) {
TWindowMenuItem* item
= dynamic_cast<TWindowMenuItem*>(menu->ItemAt(index));
if (item == NULL || NaturalCompare(item->FullTitle(),
newItem->FullTitle()) > 0)
return index;
}
// we should never get here
return index;
}