summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-09-11 19:42:02 +0000
committerDavid Robillard <d@drobilla.net>2015-09-11 19:42:02 +0000
commit36b470397a178ca64bc6d98ecc652aaa7671c938 (patch)
treee9749b710d23c1c1abf28c158e2c80d7036efef2
parent0dc88a80b345e0c2fe13bf54a0d57b348f6205d2 (diff)
downloadsuil-36b470397a178ca64bc6d98ecc652aaa7671c938.tar.gz
suil-36b470397a178ca64bc6d98ecc652aaa7671c938.tar.bz2
suil-36b470397a178ca64bc6d98ecc652aaa7671c938.zip
Zero-initialize wrapper structs.
git-svn-id: http://svn.drobilla.net/lad/trunk/suil@5723 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/cocoa_in_gtk2.mm2
-rw-r--r--src/gtk2_in_qt4.cpp7
-rw-r--r--src/qt4_in_gtk2.cpp7
-rw-r--r--src/win_in_gtk2.cpp2
-rw-r--r--src/x11_in_gtk2.c2
-rw-r--r--src/x11_in_qt4.cpp6
6 files changed, 10 insertions, 16 deletions
diff --git a/src/cocoa_in_gtk2.mm b/src/cocoa_in_gtk2.mm
index 09ca883..f2866fe 100644
--- a/src/cocoa_in_gtk2.mm
+++ b/src/cocoa_in_gtk2.mm
@@ -376,7 +376,7 @@ suil_wrapper_new(SuilHost* host,
return NULL;
}
- SuilWrapper* wrapper = (SuilWrapper*)malloc(sizeof(SuilWrapper));
+ SuilWrapper* wrapper = (SuilWrapper*)calloc(1, sizeof(SuilWrapper));
wrapper->wrap = wrapper_wrap;
wrapper->free = wrapper_free;
diff --git a/src/gtk2_in_qt4.cpp b/src/gtk2_in_qt4.cpp
index 731a4d8..641d1ba 100644
--- a/src/gtk2_in_qt4.cpp
+++ b/src/gtk2_in_qt4.cpp
@@ -127,10 +127,7 @@ suil_wrapper_new(SuilHost* host,
/* Create wrapper implementation. */
SuilGtk2InQt4Wrapper* const impl = (SuilGtk2InQt4Wrapper*)
- malloc(sizeof(SuilGtk2InQt4Wrapper));
- impl->host_widget = NULL;
- impl->parent = NULL;
- impl->plug = NULL;
+ calloc(1, sizeof(SuilGtk2InQt4Wrapper));
/* Set parent widget if given. */
for (unsigned i = 0; i < n_features; ++i) {
@@ -139,7 +136,7 @@ suil_wrapper_new(SuilHost* host,
}
}
- SuilWrapper* wrapper = (SuilWrapper*)malloc(sizeof(SuilWrapper));
+ SuilWrapper* wrapper = (SuilWrapper*)calloc(1, sizeof(SuilWrapper));
wrapper->wrap = wrapper_wrap;
wrapper->free = wrapper_free;
wrapper->impl = impl;
diff --git a/src/qt4_in_gtk2.cpp b/src/qt4_in_gtk2.cpp
index d7c6225..ab58838 100644
--- a/src/qt4_in_gtk2.cpp
+++ b/src/qt4_in_gtk2.cpp
@@ -135,10 +135,9 @@ suil_wrapper_new(SuilHost* host,
LV2_Feature*** features,
unsigned n_features)
{
- SuilWrapper* wrapper = (SuilWrapper*)malloc(sizeof(SuilWrapper));
- wrapper->wrap = wrapper_wrap;
- wrapper->free = wrapper_free;
- wrapper->impl = NULL;
+ SuilWrapper* wrapper = (SuilWrapper*)calloc(1, sizeof(SuilWrapper));
+ wrapper->wrap = wrapper_wrap;
+ wrapper->free = wrapper_free;
SuilQtWrapper* const wrap = SUIL_QT_WRAPPER(
g_object_new(SUIL_TYPE_QT_WRAPPER, NULL));
diff --git a/src/win_in_gtk2.cpp b/src/win_in_gtk2.cpp
index 4cc19c1..eabc1ac 100644
--- a/src/win_in_gtk2.cpp
+++ b/src/win_in_gtk2.cpp
@@ -212,7 +212,7 @@ suil_wrapper_new(SuilHost* host,
return NULL;
}
- SuilWrapper* wrapper = (SuilWrapper*)malloc(sizeof(SuilWrapper));
+ SuilWrapper* wrapper = (SuilWrapper*)calloc(1, sizeof(SuilWrapper));
wrapper->wrap = wrapper_wrap;
wrapper->free = wrapper_free;
diff --git a/src/x11_in_gtk2.c b/src/x11_in_gtk2.c
index 000f600..51856e9 100644
--- a/src/x11_in_gtk2.c
+++ b/src/x11_in_gtk2.c
@@ -299,7 +299,7 @@ suil_wrapper_new(SuilHost* host,
LV2_Feature*** features,
unsigned n_features)
{
- SuilWrapper* wrapper = (SuilWrapper*)malloc(sizeof(SuilWrapper));
+ SuilWrapper* wrapper = (SuilWrapper*)calloc(1, sizeof(SuilWrapper));
wrapper->wrap = wrapper_wrap;
wrapper->free = wrapper_free;
diff --git a/src/x11_in_qt4.cpp b/src/x11_in_qt4.cpp
index 8880dbe..fa58fc5 100644
--- a/src/x11_in_qt4.cpp
+++ b/src/x11_in_qt4.cpp
@@ -124,11 +124,9 @@ suil_wrapper_new(SuilHost* host,
unsigned n_features)
{
SuilX11InQt4Wrapper* const impl = (SuilX11InQt4Wrapper*)
- malloc(sizeof(SuilX11InQt4Wrapper));
- impl->host_widget = NULL;
- impl->parent = NULL;
+ calloc(1, sizeof(SuilX11InQt4Wrapper));
- SuilWrapper* wrapper = (SuilWrapper*)malloc(sizeof(SuilWrapper));
+ SuilWrapper* wrapper = (SuilWrapper*)calloc(1, sizeof(SuilWrapper));
wrapper->wrap = wrapper_wrap;
wrapper->free = wrapper_free;