mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-21 21:38:00 +01:00
No need to call memset after wmalloc
memset is the last function call in wmalloc, just before it returns the newly allocated memory. Therefore it is not needed to call it again after wmalloc call. Although I would prefer to switch wmalloc to a calloc-based wcalloc function, the compatibility of WINGs for old apps should be kept.
This commit is contained in:
committed by
Carlos R. Mafra
parent
aee0ad45f2
commit
cc30444dda
@@ -895,7 +895,6 @@ static void okNewTexture(void *data)
|
||||
WMScreen *scr = WMWidgetScreen(panel->parent);
|
||||
|
||||
titem = wmalloc(sizeof(TextureListItem));
|
||||
memset(titem, 0, sizeof(TextureListItem));
|
||||
|
||||
HideTexturePanel(panel->texturePanel);
|
||||
|
||||
@@ -1275,7 +1274,6 @@ static void fillTextureList(WMList * lPtr)
|
||||
texture = WMGetFromPLArray(textureList, i);
|
||||
|
||||
titem = wmalloc(sizeof(TextureListItem));
|
||||
memset(titem, 0, sizeof(TextureListItem));
|
||||
|
||||
titem->title = wstrdup(WMGetFromPLString(WMGetFromPLArray(texture, 0)));
|
||||
titem->prop = WMRetainPropList(WMGetFromPLArray(texture, 1));
|
||||
@@ -1876,7 +1874,6 @@ static void setupTextureFor(WMList * list, char *key, char *defValue, char *titl
|
||||
TextureListItem *titem;
|
||||
|
||||
titem = wmalloc(sizeof(TextureListItem));
|
||||
memset(titem, 0, sizeof(TextureListItem));
|
||||
|
||||
titem->title = wstrdup(title);
|
||||
titem->prop = GetObjectForKey(key);
|
||||
@@ -2044,7 +2041,6 @@ Panel *InitAppearance(WMScreen * scr, WMWindow * win)
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Appearance Preferences");
|
||||
|
||||
|
||||
@@ -467,7 +467,6 @@ Panel *InitConfigurations(WMScreen *scr, WMWidget *parent)
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Other Configurations");
|
||||
panel->description = _("Animation speeds, titlebar styles, various option\n"
|
||||
|
||||
@@ -139,7 +139,6 @@ Panel *InitExpert(WMScreen * scr, WMWidget * parent)
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Expert User Preferences");
|
||||
|
||||
|
||||
@@ -327,7 +327,6 @@ Panel *InitFocus(WMScreen * scr, WMWindow * win)
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Window Focus Preferences");
|
||||
panel->description = _("Keyboard focus switching policy and related options.");
|
||||
|
||||
@@ -712,7 +712,6 @@ Panel *InitFontSimple(WMScreen * scr, WMWidget * parent)
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Font Configuration");
|
||||
|
||||
|
||||
@@ -316,7 +316,6 @@ Panel *InitIcons(WMScreen * scr, WMWidget * parent)
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Icon Preferences");
|
||||
|
||||
|
||||
@@ -160,7 +160,6 @@ Panel *InitKeyboardSettings(WMScreen * scr, WMWidget * parent)
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Keyboard Preferences");
|
||||
|
||||
|
||||
@@ -512,7 +512,6 @@ static void createPanel(Panel * p)
|
||||
|
||||
panel->actionCount = WMGetListNumberOfRows(panel->actLs);
|
||||
panel->shortcuts = wmalloc(sizeof(char *) * panel->actionCount);
|
||||
memset(panel->shortcuts, 0, sizeof(char *) * panel->actionCount);
|
||||
|
||||
/***************** Shortcut ****************/
|
||||
|
||||
@@ -583,7 +582,6 @@ Panel *InitKeyboardShortcuts(WMScreen * scr, WMWidget * parent)
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Keyboard Shortcut Preferences");
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ static char *commandNames[] = {
|
||||
"LEGAL_PANEL"
|
||||
};
|
||||
|
||||
#define NEW(type) memset(wmalloc(sizeof(type)), 0, sizeof(type))
|
||||
#define NEW(type) wmalloc(sizeof(type))
|
||||
|
||||
#define ICON_FILE "menus"
|
||||
|
||||
@@ -1656,7 +1656,6 @@ Panel *InitMenu(WMScreen * scr, WMWidget * parent)
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Applications Menu Definition");
|
||||
|
||||
|
||||
@@ -220,7 +220,6 @@ Panel *InitMenuPreferences(WMScreen * scr, WMWidget * parent)
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Menu Preferences");
|
||||
|
||||
|
||||
@@ -790,7 +790,6 @@ Panel *InitMouseSettings(WMScreen * scr, WMWidget * parent)
|
||||
wheelActions[1] = wstrdup(_("Switch Workspaces"));
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Mouse Preferences");
|
||||
|
||||
|
||||
@@ -307,7 +307,6 @@ Panel *InitPaths(WMScreen * scr, WMWidget * parent)
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Search Path Configuration");
|
||||
|
||||
|
||||
@@ -325,7 +325,6 @@ Panel *InitPreferences(WMScreen * scr, WMWidget * parent)
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Miscellaneous Ergonomic Preferences");
|
||||
panel->description = _("Various settings like balloon text, geometry\n" "displays etc.");
|
||||
|
||||
@@ -463,7 +463,6 @@ static void gradAddCallback(WMWidget * w, void *data)
|
||||
row = WMGetListSelectedItemRow(panel->gcolL) + 1;
|
||||
item = WMInsertListItem(panel->gcolL, row, "00,00,00");
|
||||
rgb = wmalloc(sizeof(RColor));
|
||||
memset(rgb, 0, sizeof(RColor));
|
||||
item->clientData = rgb;
|
||||
|
||||
WMSelectListItem(panel->gcolL, row);
|
||||
@@ -1120,7 +1119,6 @@ TexturePanel *CreateTexturePanel(WMWindow * keyWindow)
|
||||
WMScreen *scr = WMWidgetScreen(keyWindow);
|
||||
|
||||
panel = wmalloc(sizeof(TexturePanel));
|
||||
memset(panel, 0, sizeof(TexturePanel));
|
||||
|
||||
panel->listFont = WMSystemFontOfSize(scr, 12);
|
||||
|
||||
|
||||
@@ -207,7 +207,6 @@ Panel *InitThemes(WMScreen * scr, WMWidget * parent)
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Themes");
|
||||
|
||||
|
||||
@@ -500,7 +500,6 @@ Panel *InitWindowHandling(WMScreen * scr, WMWidget * parent)
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Window Handling Preferences");
|
||||
|
||||
|
||||
@@ -327,7 +327,6 @@ Panel *InitWorkspace(WMScreen * scr, WMWidget * parent)
|
||||
_Panel *panel;
|
||||
|
||||
panel = wmalloc(sizeof(_Panel));
|
||||
memset(panel, 0, sizeof(_Panel));
|
||||
|
||||
panel->sectionName = _("Workspace Preferences");
|
||||
|
||||
|
||||
@@ -55,8 +55,6 @@ DoubleTest *CreateDoubleTest(WMWidget * parent, char *text)
|
||||
|
||||
/* allocate some storage for our new widget instance */
|
||||
dPtr = wmalloc(sizeof(DoubleTest));
|
||||
/* initialize it */
|
||||
memset(dPtr, 0, sizeof(DoubleTest));
|
||||
|
||||
/* set the class ID */
|
||||
dPtr->widgetClass = DoubleTestClass;
|
||||
|
||||
@@ -125,8 +125,6 @@ WEditMenuItem *WCreateEditMenuItem(WMWidget * parent, char *title, Bool isTitle)
|
||||
|
||||
iPtr = wmalloc(sizeof(WEditMenuItem));
|
||||
|
||||
memset(iPtr, 0, sizeof(WEditMenuItem));
|
||||
|
||||
iPtr->widgetClass = EditMenuItemClass;
|
||||
|
||||
iPtr->view = W_CreateView(W_VIEW(parent));
|
||||
@@ -373,7 +371,6 @@ static WEditMenu *makeEditMenu(WMScreen * scr, WMWidget * parent, char *title)
|
||||
InitEditMenu(scr);
|
||||
|
||||
mPtr = wmalloc(sizeof(WEditMenu));
|
||||
memset(mPtr, 0, sizeof(WEditMenu));
|
||||
|
||||
mPtr->widgetClass = EditMenuClass;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user