BScrollbar: remove unused field.

* Nothing ever reads fTargetName in the scrollbar code, so remove the
field.
* Frees one reserved slot, and a little memory, as the target name was
copied with strdup.
This commit is contained in:
Adrien Destugues
2014-04-29 16:46:00 +02:00
parent 8073fcbb39
commit 1d09e9cee3
2 changed files with 5 additions and 14 deletions
+1 -2
View File
@@ -133,11 +133,10 @@ private:
float fProportion; float fProportion;
BView* fTarget; BView* fTarget;
orientation fOrientation; orientation fOrientation;
char* fTargetName;
Private* fPrivateData; Private* fPrivateData;
uint32 _reserved[3]; uint32 _reserved[4];
}; };
#endif // _SCROLL_BAR_H #endif // _SCROLL_BAR_H
+4 -12
View File
@@ -207,8 +207,7 @@ BScrollBar::BScrollBar(BRect frame, const char* name, BView* target,
fValue(0), fValue(0),
fProportion(0.0f), fProportion(0.0f),
fTarget(NULL), fTarget(NULL),
fOrientation(direction), fOrientation(direction)
fTargetName(NULL)
{ {
SetViewColor(B_TRANSPARENT_COLOR); SetViewColor(B_TRANSPARENT_COLOR);
@@ -237,8 +236,7 @@ BScrollBar::BScrollBar(const char* name, BView* target,
fValue(0), fValue(0),
fProportion(0.0f), fProportion(0.0f),
fTarget(NULL), fTarget(NULL),
fOrientation(direction), fOrientation(direction)
fTargetName(NULL)
{ {
SetViewColor(B_TRANSPARENT_COLOR); SetViewColor(B_TRANSPARENT_COLOR);
@@ -255,8 +253,7 @@ BScrollBar::BScrollBar(const char* name, BView* target,
BScrollBar::BScrollBar(BMessage* data) BScrollBar::BScrollBar(BMessage* data)
: :
BView(data), BView(data),
fTarget(NULL), fTarget(NULL)
fTargetName(NULL)
{ {
fPrivateData = new BScrollBar::Private(this); fPrivateData = new BScrollBar::Private(this);
@@ -567,17 +564,12 @@ BScrollBar::SetTarget(BView* target)
} }
fTarget = target; fTarget = target;
free(fTargetName);
if (fTarget) { if (fTarget) {
fTargetName = strdup(target->Name());
if (fOrientation == B_VERTICAL) if (fOrientation == B_VERTICAL)
fTarget->fVerScroller = this; fTarget->fVerScroller = this;
else else
fTarget->fHorScroller = this; fTarget->fHorScroller = this;
} else }
fTargetName = NULL;
} }