Deskbar: No need to use dynamic allocation, remove unused headers.

Signed-off-by: Adrien Destugues <[email protected]>
This commit is contained in:
Dario Casalinuovo
2015-04-13 19:10:38 +02:00
committed by Adrien Destugues
parent c0af54cc3b
commit 9e11c3adb1
3 changed files with 4 additions and 11 deletions
-4
View File
@@ -36,10 +36,6 @@ All rights reserved.
#include "ShowHideMenuItem.h"
#include <malloc.h>
#include <stdio.h>
#include <strings.h>
#include <Debug.h>
#include <Roster.h>
#include <WindowInfo.h>
+4 -3
View File
@@ -37,6 +37,8 @@ All rights reserved.
#include "TruncatableMenuItem.h"
#include <StackOrHeapArray.h>
#include <stdlib.h>
#include "BarApp.h"
@@ -100,13 +102,12 @@ TTruncatableMenuItem::Label(float width)
const char* label = Label();
if (width > 0 && maxWidth > 0 && width > maxWidth) {
char* truncatedLabel = (char*)malloc(strlen(label) + 4);
if (truncatedLabel != NULL) {
BStackOrHeapArray<char, 128> truncatedLabel(strlen(label) + 4);
if (truncatedLabel.IsValid()) {
float labelWidth = menu->StringWidth(label);
float offset = width - labelWidth;
TruncateLabel(maxWidth - offset, truncatedLabel);
fTruncatedString.SetTo(truncatedLabel);
free(truncatedLabel);
return fTruncatedString.String();
}
}
-4
View File
@@ -36,10 +36,6 @@ All rights reserved.
#include "WindowMenu.h"
#include <malloc.h>
#include <stdio.h>
#include <strings.h>
#include <Catalog.h>
#include <Locale.h>
#include <Window.h>