1
0
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:
Tobias Stoeckmann
2012-05-04 22:53:04 +02:00
committed by Carlos R. Mafra
parent aee0ad45f2
commit cc30444dda
45 changed files with 3 additions and 77 deletions

View File

@@ -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");

View File

@@ -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"

View File

@@ -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");

View File

@@ -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.");

View File

@@ -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");

View File

@@ -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");

View File

@@ -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");

View File

@@ -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");

View File

@@ -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");

View File

@@ -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");

View File

@@ -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");

View File

@@ -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");

View File

@@ -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.");

View File

@@ -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);

View File

@@ -207,7 +207,6 @@ Panel *InitThemes(WMScreen * scr, WMWidget * parent)
_Panel *panel;
panel = wmalloc(sizeof(_Panel));
memset(panel, 0, sizeof(_Panel));
panel->sectionName = _("Themes");

View File

@@ -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");

View File

@@ -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");

View File

@@ -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;

View File

@@ -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;