Deskbar: No need to use dynamic allocation, remove unused headers.
Signed-off-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
c0af54cc3b
commit
9e11c3adb1
@@ -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>
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user