1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

WINGs: Make wmalloc() intialize allocated memory to 0

- Accordingly remove individual memsets, for now from WINGs only.

Signed-off-by: Tamas TEVESZ <ice@extreme.hu>
This commit is contained in:
Tamas TEVESZ
2010-09-23 14:27:48 +02:00
committed by Carlos R. Mafra
parent cf2301a048
commit a71a604ab1
34 changed files with 4 additions and 89 deletions

View File

@@ -358,16 +358,10 @@ WMBag *WMCreateTreeBagWithDestructor(WMFreeDataProc * destructor)
WMBag *bag; WMBag *bag;
bag = wmalloc(sizeof(WMBag)); bag = wmalloc(sizeof(WMBag));
memset(bag, 0, sizeof(WMBag));
bag->nil = wmalloc(sizeof(W_Node)); bag->nil = wmalloc(sizeof(W_Node));
memset(bag->nil, 0, sizeof(W_Node));
bag->nil->left = bag->nil->right = bag->nil->parent = bag->nil; bag->nil->left = bag->nil->right = bag->nil->parent = bag->nil;
bag->nil->index = WBNotFound; bag->nil->index = WBNotFound;
bag->root = bag->nil; bag->root = bag->nil;
bag->destructor = destructor; bag->destructor = destructor;
return bag; return bag;

View File

@@ -81,7 +81,6 @@ static void rebuildTable(WMHashTable * table)
newSize = table->size * 2; newSize = table->size * 2;
table->table = wmalloc(sizeof(char *) * newSize); table->table = wmalloc(sizeof(char *) * newSize);
memset(table->table, 0, sizeof(char *) * newSize);
table->size = newSize; table->size = newSize;
for (i = 0; i < oldSize; i++) { for (i = 0; i < oldSize; i++) {

View File

@@ -98,6 +98,7 @@ void *wmalloc(size_t size)
} }
} }
} }
memset(tmp, 0, size);
return tmp; return tmp;
} }

View File

@@ -35,11 +35,9 @@ WMNotification *WMCreateNotification(const char *name, void *object, void *clien
Notification *nPtr; Notification *nPtr;
nPtr = wmalloc(sizeof(Notification)); nPtr = wmalloc(sizeof(Notification));
nPtr->name = name; nPtr->name = name;
nPtr->object = object; nPtr->object = object;
nPtr->clientData = clientData; nPtr->clientData = clientData;
nPtr->refCount = 1; nPtr->refCount = 1;
return nPtr; return nPtr;
@@ -89,11 +87,9 @@ static NotificationCenter *notificationCenter = NULL;
void W_InitNotificationCenter(void) void W_InitNotificationCenter(void)
{ {
notificationCenter = wmalloc(sizeof(NotificationCenter)); notificationCenter = wmalloc(sizeof(NotificationCenter));
notificationCenter->nameTable = WMCreateHashTable(WMStringPointerHashCallbacks); notificationCenter->nameTable = WMCreateHashTable(WMStringPointerHashCallbacks);
notificationCenter->objectTable = WMCreateHashTable(WMIntHashCallbacks); notificationCenter->objectTable = WMCreateHashTable(WMIntHashCallbacks);
notificationCenter->nilList = NULL; notificationCenter->nilList = NULL;
notificationCenter->observerTable = WMCreateHashTable(WMIntHashCallbacks); notificationCenter->observerTable = WMCreateHashTable(WMIntHashCallbacks);
} }
@@ -366,7 +362,6 @@ WMNotificationQueue *WMCreateNotificationQueue(void)
NotificationQueue *queue; NotificationQueue *queue;
queue = wmalloc(sizeof(NotificationQueue)); queue = wmalloc(sizeof(NotificationQueue));
queue->asapQueue = WMCreateArrayWithDestructor(8, (WMFreeDataProc *) WMReleaseNotification); queue->asapQueue = WMCreateArrayWithDestructor(8, (WMFreeDataProc *) WMReleaseNotification);
queue->idleQueue = WMCreateArrayWithDestructor(8, (WMFreeDataProc *) WMReleaseNotification); queue->idleQueue = WMCreateArrayWithDestructor(8, (WMFreeDataProc *) WMReleaseNotification);
queue->next = notificationQueueList; queue->next = notificationQueueList;

View File

@@ -891,7 +891,6 @@ WMPropList *WMCreatePLString(char *str)
wassertrv(str != NULL, NULL); wassertrv(str != NULL, NULL);
plist = (WMPropList *) wmalloc(sizeof(W_PropList)); plist = (WMPropList *) wmalloc(sizeof(W_PropList));
plist->type = WPLString; plist->type = WPLString;
plist->d.string = wstrdup(str); plist->d.string = wstrdup(str);
plist->retainCount = 1; plist->retainCount = 1;
@@ -906,7 +905,6 @@ WMPropList *WMCreatePLData(WMData * data)
wassertrv(data != NULL, NULL); wassertrv(data != NULL, NULL);
plist = (WMPropList *) wmalloc(sizeof(W_PropList)); plist = (WMPropList *) wmalloc(sizeof(W_PropList));
plist->type = WPLData; plist->type = WPLData;
plist->d.data = WMRetainData(data); plist->d.data = WMRetainData(data);
plist->retainCount = 1; plist->retainCount = 1;
@@ -921,7 +919,6 @@ WMPropList *WMCreatePLDataWithBytes(unsigned char *bytes, unsigned int length)
wassertrv(bytes != NULL, NULL); wassertrv(bytes != NULL, NULL);
plist = (WMPropList *) wmalloc(sizeof(W_PropList)); plist = (WMPropList *) wmalloc(sizeof(W_PropList));
plist->type = WPLData; plist->type = WPLData;
plist->d.data = WMCreateDataWithBytes(bytes, length); plist->d.data = WMCreateDataWithBytes(bytes, length);
plist->retainCount = 1; plist->retainCount = 1;
@@ -936,7 +933,6 @@ WMPropList *WMCreatePLDataWithBytesNoCopy(unsigned char *bytes, unsigned int len
wassertrv(bytes != NULL, NULL); wassertrv(bytes != NULL, NULL);
plist = (WMPropList *) wmalloc(sizeof(W_PropList)); plist = (WMPropList *) wmalloc(sizeof(W_PropList));
plist->type = WPLData; plist->type = WPLData;
plist->d.data = WMCreateDataWithBytesNoCopy(bytes, length, destructor); plist->d.data = WMCreateDataWithBytesNoCopy(bytes, length, destructor);
plist->retainCount = 1; plist->retainCount = 1;

View File

@@ -341,7 +341,6 @@ Bool WMCreateSelectionHandler(WMView * view, Atom selection, Time timestamp, WMS
/*//printf("created selection handler for %d\n", W_VIEW_DRAWABLE(view)); */ /*//printf("created selection handler for %d\n", W_VIEW_DRAWABLE(view)); */
handler = wmalloc(sizeof(SelectionHandler)); handler = wmalloc(sizeof(SelectionHandler));
handler->view = view; handler->view = view;
handler->selection = selection; handler->selection = selection;
handler->timestamp = timestamp; handler->timestamp = timestamp;
@@ -373,14 +372,12 @@ WMRequestSelection(WMView * view, Atom selection, Atom target, Time timestamp,
} }
handler = wmalloc(sizeof(SelectionCallback)); handler = wmalloc(sizeof(SelectionCallback));
handler->view = view; handler->view = view;
handler->selection = selection; handler->selection = selection;
handler->target = target; handler->target = target;
handler->timestamp = timestamp; handler->timestamp = timestamp;
handler->callback = callback; handler->callback = callback;
handler->data = cdata; handler->data = cdata;
memset(&handler->flags, 0, sizeof(handler->flags));
if (selCallbacks == NULL) { if (selCallbacks == NULL) {
selCallbacks = WMCreateArrayWithDestructor(4, wfree); selCallbacks = WMCreateArrayWithDestructor(4, wfree);

View File

@@ -41,7 +41,6 @@ char *wtokennext(char *word, char **next)
ptr = word; ptr = word;
state = 0; state = 0;
*t = 0;
while (1) { while (1) {
if (*ptr == 0) if (*ptr == 0)
ctype = PRC_EOS; ctype = PRC_EOS;
@@ -121,7 +120,6 @@ char *wtokenjoin(char **list, int count)
flat_string = wmalloc(j + count + 1); flat_string = wmalloc(j + count + 1);
*flat_string = 0;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (list[i] != NULL && list[i][0] != 0) { if (list[i] != NULL && list[i][0] != 0) {
if (i > 0) if (i > 0)

View File

@@ -40,10 +40,7 @@ WMTreeNode *WMCreateTreeNodeWithDestructor(void *data, WMFreeDataProc * destruct
WMTreeNode *aNode; WMTreeNode *aNode;
aNode = (WMTreeNode *) wmalloc(sizeof(W_TreeNode)); aNode = (WMTreeNode *) wmalloc(sizeof(W_TreeNode));
memset(aNode, 0, sizeof(W_TreeNode));
aNode->destructor = destructor; aNode->destructor = destructor;
aNode->data = data; aNode->data = data;
aNode->parent = NULL; aNode->parent = NULL;
aNode->depth = 0; aNode->depth = 0;

View File

@@ -263,10 +263,7 @@ WMUserDefaults *WMGetStandardUserDefaults(void)
/* we didn't found the database we are looking for. Go read it. */ /* we didn't found the database we are looking for. Go read it. */
defaults = wmalloc(sizeof(WMUserDefaults)); defaults = wmalloc(sizeof(WMUserDefaults));
memset(defaults, 0, sizeof(WMUserDefaults));
defaults->defaults = WMCreatePLDictionary(NULL, NULL); defaults->defaults = WMCreatePLDictionary(NULL, NULL);
defaults->searchList = wmalloc(sizeof(WMPropList *) * 3); defaults->searchList = wmalloc(sizeof(WMPropList *) * 3);
/* application domain */ /* application domain */
@@ -355,12 +352,9 @@ WMUserDefaults *WMGetDefaultsFromPath(char *path)
} }
} }
/* we didn't found the database we are looking for. Go read it. */ /* we didn't found the database we are looking for. Go read it. XXX wtf? */
defaults = wmalloc(sizeof(WMUserDefaults)); defaults = wmalloc(sizeof(WMUserDefaults));
memset(defaults, 0, sizeof(WMUserDefaults));
defaults->defaults = WMCreatePLDictionary(NULL, NULL); defaults->defaults = WMCreatePLDictionary(NULL, NULL);
defaults->searchList = wmalloc(sizeof(WMPropList *) * 2); defaults->searchList = wmalloc(sizeof(WMPropList *) * 2);
/* the domain we want, go in the first position */ /* the domain we want, go in the first position */

View File

@@ -50,7 +50,6 @@ struct W_Balloon *W_CreateBalloon(WMScreen * scr)
Balloon *bPtr; Balloon *bPtr;
bPtr = wmalloc(sizeof(Balloon)); bPtr = wmalloc(sizeof(Balloon));
memset(bPtr, 0, sizeof(Balloon));
bPtr->view = W_CreateUnmanagedTopView(scr); bPtr->view = W_CreateUnmanagedTopView(scr);
if (!bPtr->view) { if (!bPtr->view) {

View File

@@ -44,7 +44,6 @@ WMBox *WMCreateBox(WMWidget * parent)
Box *bPtr; Box *bPtr;
bPtr = wmalloc(sizeof(Box)); bPtr = wmalloc(sizeof(Box));
memset(bPtr, 0, sizeof(Box));
bPtr->widgetClass = WC_Box; bPtr->widgetClass = WC_Box;

View File

@@ -95,7 +95,6 @@ WMBrowser *WMCreateBrowser(WMWidget * parent)
wassertrv(parent, NULL); wassertrv(parent, NULL);
bPtr = wmalloc(sizeof(WMBrowser)); bPtr = wmalloc(sizeof(WMBrowser));
memset(bPtr, 0, sizeof(WMBrowser));
bPtr->widgetClass = WC_Browser; bPtr->widgetClass = WC_Browser;

View File

@@ -374,8 +374,6 @@ static WMColorPanel *makeColorPanel(WMScreen * scrPtr, char *name)
GC wgc = WMColorGC(scrPtr->white); GC wgc = WMColorGC(scrPtr->white);
panel = wmalloc(sizeof(WMColorPanel)); panel = wmalloc(sizeof(WMColorPanel));
memset(panel, 0, sizeof(WMColorPanel));
panel->color.rgb.red = 0; panel->color.rgb.red = 0;
panel->color.rgb.green = 0; panel->color.rgb.green = 0;
panel->color.rgb.blue = 0; panel->color.rgb.blue = 0;
@@ -1842,7 +1840,6 @@ static wheelMatrix *wheelCreateMatrix(unsigned int width, unsigned int height)
assert((width > 0) && (height > 0)); assert((width > 0) && (height > 0));
matrix = wmalloc(sizeof(wheelMatrix)); matrix = wmalloc(sizeof(wheelMatrix));
memset(matrix, 0, sizeof(wheelMatrix));
matrix->width = width; matrix->width = width;
matrix->height = height; matrix->height = height;
@@ -3446,15 +3443,7 @@ RColor ulongToRColor(WMScreen * scr, unsigned long value)
RColor color; RColor color;
XColor *xcolor = NULL; XColor *xcolor = NULL;
if (!(xcolor = wmalloc(sizeof(XColor)))) { xcolor = wmalloc(sizeof(XColor));
wwarning(_("Color Panel: Could not allocate memory"));
color.red = 0;
color.green = 0;
color.blue = 0;
color.alpha = 0;
return color;
}
xcolor->pixel = value; xcolor->pixel = value;
XQueryColor(scr->display, scr->rcontext->cmap, xcolor); XQueryColor(scr->display, scr->rcontext->cmap, xcolor);

View File

@@ -138,7 +138,6 @@ WMColorWell *WMCreateColorWell(WMWidget * parent)
ColorWell *cPtr; ColorWell *cPtr;
cPtr = wmalloc(sizeof(ColorWell)); cPtr = wmalloc(sizeof(ColorWell));
memset(cPtr, 0, sizeof(ColorWell));
cPtr->widgetClass = WC_ColorWell; cPtr->widgetClass = WC_ColorWell;

View File

@@ -170,7 +170,6 @@ static WMFilePanel *makeFilePanel(WMScreen * scrPtr, char *name, char *title)
WMPixmap *icon; WMPixmap *icon;
fPtr = wmalloc(sizeof(WMFilePanel)); fPtr = wmalloc(sizeof(WMFilePanel));
memset(fPtr, 0, sizeof(WMFilePanel));
fPtr->win = WMCreateWindowWithStyle(scrPtr, name, WMTitledWindowMask | WMResizableWindowMask); fPtr->win = WMCreateWindowWithStyle(scrPtr, name, WMTitledWindowMask | WMResizableWindowMask);
WMResizeWidget(fPtr->win, PWIDTH, PHEIGHT); WMResizeWidget(fPtr->win, PWIDTH, PHEIGHT);

View File

@@ -139,7 +139,6 @@ WMFont *WMCreateFont(WMScreen * scrPtr, char *fontName)
} }
font = wmalloc(sizeof(WMFont)); font = wmalloc(sizeof(WMFont));
memset(font, 0, sizeof(WMFont));
font->screen = scrPtr; font->screen = scrPtr;

View File

@@ -165,7 +165,6 @@ WMFontPanel *WMGetFontPanel(WMScreen * scr)
return scr->sharedFontPanel; return scr->sharedFontPanel;
panel = wmalloc(sizeof(FontPanel)); panel = wmalloc(sizeof(FontPanel));
memset(panel, 0, sizeof(FontPanel));
panel->win = WMCreateWindow(scr, "fontPanel"); panel->win = WMCreateWindow(scr, "fontPanel");
/* WMSetWidgetBackgroundColor(panel->win, WMWhiteColor(scr)); */ /* WMSetWidgetBackgroundColor(panel->win, WMWhiteColor(scr)); */
@@ -461,7 +460,6 @@ static void addTypefaceToXftFamily(Family * fam, char *style)
} }
face = wmalloc(sizeof(Typeface)); face = wmalloc(sizeof(Typeface));
memset(face, 0, sizeof(Typeface));
face->typeface = wstrdup(style); face->typeface = wstrdup(style);
face->sizes = WMCreateArray(4); face->sizes = WMCreateArray(4);

View File

@@ -221,7 +221,6 @@ WMFrame *WMCreateFrame(WMWidget * parent)
Frame *fPtr; Frame *fPtr;
fPtr = wmalloc(sizeof(Frame)); fPtr = wmalloc(sizeof(Frame));
memset(fPtr, 0, sizeof(Frame));
fPtr->widgetClass = WC_Frame; fPtr->widgetClass = WC_Frame;

View File

@@ -39,7 +39,6 @@ WMLabel *WMCreateLabel(WMWidget * parent)
Label *lPtr; Label *lPtr;
lPtr = wmalloc(sizeof(Label)); lPtr = wmalloc(sizeof(Label));
memset(lPtr, 0, sizeof(Label));
lPtr->widgetClass = WC_Label; lPtr->widgetClass = WC_Label;

View File

@@ -110,7 +110,6 @@ WMList *WMCreateList(WMWidget * parent)
W_Screen *scrPtr = W_VIEW(parent)->screen; W_Screen *scrPtr = W_VIEW(parent)->screen;
lPtr = wmalloc(sizeof(List)); lPtr = wmalloc(sizeof(List));
memset(lPtr, 0, sizeof(List));
lPtr->widgetClass = WC_List; lPtr->widgetClass = WC_List;
@@ -187,7 +186,6 @@ WMListItem *WMInsertListItem(WMList * lPtr, int row, char *text)
CHECK_CLASS(lPtr, WC_List); CHECK_CLASS(lPtr, WC_List);
item = wmalloc(sizeof(WMListItem)); item = wmalloc(sizeof(WMListItem));
memset(item, 0, sizeof(WMListItem));
item->text = wstrdup(text); item->text = wstrdup(text);
row = WMIN(row, WMGetArrayItemCount(lPtr->items)); row = WMIN(row, WMGetArrayItemCount(lPtr->items));

View File

@@ -41,7 +41,6 @@ WMMenuItem *WMCreateMenuItem(void)
WMMenuItem *item; WMMenuItem *item;
item = wmalloc(sizeof(MenuItem)); item = wmalloc(sizeof(MenuItem));
memset(item, 0, sizeof(MenuItem));
item->flags.enabled = 1; item->flags.enabled = 1;

View File

@@ -94,7 +94,6 @@ WMAlertPanel *WMCreateAlertPanel(WMScreen * scrPtr, WMWindow * owner,
WMPixmap *icon; WMPixmap *icon;
panel = wmalloc(sizeof(WMAlertPanel)); panel = wmalloc(sizeof(WMAlertPanel));
memset(panel, 0, sizeof(WMAlertPanel));
if (owner) { if (owner) {
panel->win = WMCreatePanelWithStyleForWindow(owner, "alertPanel", WMTitledWindowMask); panel->win = WMCreatePanelWithStyleForWindow(owner, "alertPanel", WMTitledWindowMask);
@@ -342,7 +341,6 @@ WMInputPanel *WMCreateInputPanel(WMScreen * scrPtr, WMWindow * owner, char *titl
int x, dw = 0, aw = 0, w; int x, dw = 0, aw = 0, w;
panel = wmalloc(sizeof(WMInputPanel)); panel = wmalloc(sizeof(WMInputPanel));
memset(panel, 0, sizeof(WMInputPanel));
if (owner) if (owner)
panel->win = WMCreatePanelWithStyleForWindow(owner, "inputPanel", WMTitledWindowMask); panel->win = WMCreatePanelWithStyleForWindow(owner, "inputPanel", WMTitledWindowMask);
@@ -464,7 +462,6 @@ WMGenericPanel *WMCreateGenericPanel(WMScreen * scrPtr, WMWindow * owner,
WMPixmap *icon; WMPixmap *icon;
panel = wmalloc(sizeof(WMGenericPanel)); panel = wmalloc(sizeof(WMGenericPanel));
memset(panel, 0, sizeof(WMGenericPanel));
if (owner) { if (owner) {
panel->win = WMCreatePanelWithStyleForWindow(owner, "genericPanel", WMTitledWindowMask); panel->win = WMCreatePanelWithStyleForWindow(owner, "genericPanel", WMTitledWindowMask);

View File

@@ -57,7 +57,6 @@ WMPopUpButton *WMCreatePopUpButton(WMWidget * parent)
W_Screen *scr = W_VIEW(parent)->screen; W_Screen *scr = W_VIEW(parent)->screen;
bPtr = wmalloc(sizeof(PopUpButton)); bPtr = wmalloc(sizeof(PopUpButton));
memset(bPtr, 0, sizeof(PopUpButton));
bPtr->widgetClass = WC_PopUpButton; bPtr->widgetClass = WC_PopUpButton;

View File

@@ -43,7 +43,6 @@ WMProgressIndicator *WMCreateProgressIndicator(WMWidget * parent)
ProgressIndicator *pPtr; ProgressIndicator *pPtr;
pPtr = wmalloc(sizeof(ProgressIndicator)); pPtr = wmalloc(sizeof(ProgressIndicator));
memset(pPtr, 0, sizeof(ProgressIndicator));
pPtr->widgetClass = WC_ProgressIndicator; pPtr->widgetClass = WC_ProgressIndicator;

View File

@@ -384,8 +384,6 @@ WMRuler *WMCreateRuler(WMWidget * parent)
Ruler *rPtr = wmalloc(sizeof(Ruler)); Ruler *rPtr = wmalloc(sizeof(Ruler));
unsigned int w = WMWidgetWidth(parent); unsigned int w = WMWidgetWidth(parent);
memset(rPtr, 0, sizeof(Ruler));
rPtr->widgetClass = WC_Ruler; rPtr->widgetClass = WC_Ruler;
rPtr->view = W_CreateView(W_VIEW(parent)); rPtr->view = W_CreateView(W_VIEW(parent));

View File

@@ -84,8 +84,6 @@ WMScroller *WMCreateScroller(WMWidget * parent)
Scroller *sPtr; Scroller *sPtr;
sPtr = wmalloc(sizeof(Scroller)); sPtr = wmalloc(sizeof(Scroller));
memset(sPtr, 0, sizeof(Scroller));
sPtr->widgetClass = WC_Scroller; sPtr->widgetClass = WC_Scroller;
sPtr->view = W_CreateView(W_VIEW(parent)); sPtr->view = W_CreateView(W_VIEW(parent));

View File

@@ -44,8 +44,6 @@ WMScrollView *WMCreateScrollView(WMWidget * parent)
ScrollView *sPtr; ScrollView *sPtr;
sPtr = wmalloc(sizeof(ScrollView)); sPtr = wmalloc(sizeof(ScrollView));
memset(sPtr, 0, sizeof(ScrollView));
sPtr->widgetClass = WC_ScrollView; sPtr->widgetClass = WC_ScrollView;
sPtr->view = W_CreateView(W_VIEW(parent)); sPtr->view = W_CreateView(W_VIEW(parent));

View File

@@ -57,8 +57,6 @@ WMSlider *WMCreateSlider(WMWidget * parent)
Slider *sPtr; Slider *sPtr;
sPtr = wmalloc(sizeof(Slider)); sPtr = wmalloc(sizeof(Slider));
memset(sPtr, 0, sizeof(Slider));
sPtr->widgetClass = WC_Slider; sPtr->widgetClass = WC_Slider;
sPtr->view = W_CreateView(W_VIEW(parent)); sPtr->view = W_CreateView(W_VIEW(parent));

View File

@@ -607,8 +607,6 @@ WMSplitView *WMCreateSplitView(WMWidget * parent)
WMSplitView *sPtr; WMSplitView *sPtr;
sPtr = wmalloc(sizeof(WMSplitView)); sPtr = wmalloc(sizeof(WMSplitView));
memset(sPtr, 0, sizeof(WMSplitView));
sPtr->widgetClass = WC_SplitView; sPtr->widgetClass = WC_SplitView;
sPtr->view = W_CreateView(W_VIEW(parent)); sPtr->view = W_CreateView(W_VIEW(parent));

View File

@@ -190,8 +190,6 @@ WMTabView *WMCreateTabView(WMWidget * parent)
WMScreen *scr = WMWidgetScreen(parent); WMScreen *scr = WMWidgetScreen(parent);
tPtr = wmalloc(sizeof(TabView)); tPtr = wmalloc(sizeof(TabView));
memset(tPtr, 0, sizeof(TabView));
tPtr->widgetClass = WC_TabView; tPtr->widgetClass = WC_TabView;
tPtr->view = W_CreateView(W_VIEW(parent)); tPtr->view = W_CreateView(W_VIEW(parent));
@@ -258,7 +256,7 @@ void WMInsertItemInTabView(WMTabView * tPtr, int index, WMTabViewItem * item)
WMTabViewItem **items; WMTabViewItem **items;
items = wrealloc(tPtr->items, sizeof(WMTabViewItem *) * (tPtr->maxItems + 10)); items = wrealloc(tPtr->items, sizeof(WMTabViewItem *) * (tPtr->maxItems + 10));
memset(&items[tPtr->maxItems], 0, sizeof(WMTabViewItem *) * 10); memset(&items[tPtr->maxItems], 0, sizeof(WMTabViewItem *) * 10); /* XXX */
tPtr->items = items; tPtr->items = items;
tPtr->maxItems += 10; tPtr->maxItems += 10;
} }
@@ -819,10 +817,7 @@ WMTabViewItem *WMCreateTabViewItemWithIdentifier(int identifier)
WMTabViewItem *item; WMTabViewItem *item;
item = wmalloc(sizeof(WMTabViewItem)); item = wmalloc(sizeof(WMTabViewItem));
memset(item, 0, sizeof(WMTabViewItem));
item->identifier = identifier; item->identifier = identifier;
item->flags.enabled = 1; item->flags.enabled = 1;
return item; return item;
@@ -833,10 +828,7 @@ WMTabViewItem *WMCreateTabViewItem(int identifier, char *label)
WMTabViewItem *item; WMTabViewItem *item;
item = wmalloc(sizeof(WMTabViewItem)); item = wmalloc(sizeof(WMTabViewItem));
memset(item, 0, sizeof(WMTabViewItem));
item->identifier = identifier; item->identifier = identifier;
item->flags.enabled = 1; item->flags.enabled = 1;
WMSetTabViewItemLabel(item, label); WMSetTabViewItemLabel(item, label);

View File

@@ -2935,7 +2935,6 @@ WMText *WMCreateTextForDocumentType(WMWidget * parent, WMAction * parser, WMActi
XGCValues gcv; XGCValues gcv;
tPtr = wmalloc(sizeof(Text)); tPtr = wmalloc(sizeof(Text));
memset(tPtr, 0, sizeof(Text));
tPtr->widgetClass = WC_Text; tPtr->widgetClass = WC_Text;
tPtr->view = W_CreateView(W_VIEW(parent)); tPtr->view = W_CreateView(W_VIEW(parent));
if (!tPtr->view) { if (!tPtr->view) {
@@ -3232,7 +3231,6 @@ void *WMCreateTextBlockWithText(WMText * tPtr, char *text, WMFont * font, WMColo
tb->allocated = reqBlockSize(len); tb->allocated = reqBlockSize(len);
tb->text = (char *)wmalloc(tb->allocated); tb->text = (char *)wmalloc(tb->allocated);
memset(tb->text, 0, tb->allocated);
if (len < 1 || !text || (*text == '\n' && len == 1)) { if (len < 1 || !text || (*text == '\n' && len == 1)) {
*tb->text = ' '; *tb->text = ' ';

View File

@@ -316,8 +316,6 @@ WMTextField *WMCreateTextField(WMWidget * parent)
TextField *tPtr; TextField *tPtr;
tPtr = wmalloc(sizeof(TextField)); tPtr = wmalloc(sizeof(TextField));
memset(tPtr, 0, sizeof(TextField));
tPtr->widgetClass = WC_TextField; tPtr->widgetClass = WC_TextField;
tPtr->view = W_CreateView(W_VIEW(parent)); tPtr->view = W_CreateView(W_VIEW(parent));
@@ -335,7 +333,6 @@ WMTextField *WMCreateTextField(WMWidget * parent)
W_SetViewBackgroundColor(tPtr->view, tPtr->view->screen->white); W_SetViewBackgroundColor(tPtr->view, tPtr->view->screen->white);
tPtr->text = wmalloc(MIN_TEXT_BUFFER); tPtr->text = wmalloc(MIN_TEXT_BUFFER);
tPtr->text[0] = 0;
tPtr->textLen = 0; tPtr->textLen = 0;
tPtr->bufferSize = MIN_TEXT_BUFFER; tPtr->bufferSize = MIN_TEXT_BUFFER;

View File

@@ -93,8 +93,6 @@ static W_View *createView(W_Screen * screen, W_View * parent)
ViewContext = XUniqueContext(); ViewContext = XUniqueContext();
view = wmalloc(sizeof(W_View)); view = wmalloc(sizeof(W_View));
memset(view, 0, sizeof(W_View));
view->screen = screen; view->screen = screen;
if (parent != NULL) { if (parent != NULL) {

View File

@@ -135,8 +135,6 @@ WMWindow *WMCreateWindowWithStyle(WMScreen * screen, char *name, int style)
_Window *win; _Window *win;
win = wmalloc(sizeof(_Window)); win = wmalloc(sizeof(_Window));
memset(win, 0, sizeof(_Window));
win->widgetClass = WC_Window; win->widgetClass = WC_Window;
win->view = W_CreateTopView(screen); win->view = W_CreateTopView(screen);