[libdmapsharing] Use g_new0
- From: W. Michael Petullo <wmpetullo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdmapsharing] Use g_new0
- Date: Sat, 12 Nov 2016 01:52:34 +0000 (UTC)
commit 9e5647133672aa94bc105d0c17140455c04a323b
Author: W. Michael Petullo <mike flyn org>
Date: Fri Nov 11 20:52:02 2016 -0500
Use g_new0
https://bugzilla.gnome.org/show_bug.cgi?id=773400
Signed-off-by: W. Michael Petullo <mike flyn org>
libdmapsharing/daap-share.c | 2 +-
libdmapsharing/dacp-share.c | 4 ++--
libdmapsharing/dmap-connection.c | 4 ++--
libdmapsharing/dmap-mdns-browser-avahi.c | 2 +-
libdmapsharing/dmap-mdns-browser-dnssd.c | 3 ++-
libdmapsharing/dmap-mdns-browser-howl.c | 4 +++-
libdmapsharing/dmap-mdns-publisher-avahi.c | 2 +-
libdmapsharing/dmap-share.c | 4 ++--
libdmapsharing/dpap-share.c | 2 +-
9 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/libdmapsharing/daap-share.c b/libdmapsharing/daap-share.c
index 798cadc..e025196 100644
--- a/libdmapsharing/daap-share.c
+++ b/libdmapsharing/daap-share.c
@@ -415,7 +415,7 @@ send_chunked_file (SoupServer * server, SoupMessage * message,
GError *error = NULL;
ChunkData *cd = NULL;
- cd = g_new (ChunkData, 1);
+ cd = g_new0 (ChunkData, 1);
g_object_get (record, "location", &location, "has-video", &has_video, NULL);
if (NULL == location) {
diff --git a/libdmapsharing/dacp-share.c b/libdmapsharing/dacp-share.c
index 50934db..4704724 100644
--- a/libdmapsharing/dacp-share.c
+++ b/libdmapsharing/dacp-share.c
@@ -388,11 +388,11 @@ mdns_remote_added (DMAPMdnsBrowser * browser,
{
DACPRemoteInfo *remote_info;
- remote_info = g_new (DACPRemoteInfo, 1);
+ remote_info = g_new0 (DACPRemoteInfo, 1);
remote_info->host = g_strdup (service->host);
remote_info->port = service->port;
- remote_info->connection = NULL;
remote_info->pair_txt = g_strdup (service->pair);
+ remote_info->connection = NULL;
g_debug ("New Remote found: %s name=%s host=%s port=%u pair=%s",
service->service_name,
diff --git a/libdmapsharing/dmap-connection.c b/libdmapsharing/dmap-connection.c
index d222835..3bc749a 100644
--- a/libdmapsharing/dmap-connection.c
+++ b/libdmapsharing/dmap-connection.c
@@ -1256,7 +1256,7 @@ dmap_connection_connect (DMAPConnection * connection,
g_strdup_printf ("daap://%s:%d", connection->priv->host,
connection->priv->port);
- rdata = g_new (ConnectionResponseData, 1);
+ rdata = g_new0 (ConnectionResponseData, 1);
rdata->connection = g_object_ref (connection);
rdata->callback = callback;
rdata->data = user_data;
@@ -1334,7 +1334,7 @@ dmap_connection_disconnect (DMAPConnection * connection,
// FIXME: GDK_THREADS_ENTER ();
}
- rdata = g_new (ConnectionResponseData, 1);
+ rdata = g_new0 (ConnectionResponseData, 1);
rdata->connection = g_object_ref (connection);
rdata->callback = callback;
rdata->data = user_data;
diff --git a/libdmapsharing/dmap-mdns-browser-avahi.c b/libdmapsharing/dmap-mdns-browser-avahi.c
index aed9aa8..8daa8d0 100644
--- a/libdmapsharing/dmap-mdns-browser-avahi.c
+++ b/libdmapsharing/dmap-mdns-browser-avahi.c
@@ -431,7 +431,7 @@ resolve_cb (AvahiServiceResolver * service_resolver,
avahi_address_snprint (host, AVAHI_ADDRESS_STR_MAX, address);
- service = g_new (DMAPMdnsBrowserService, 1);
+ service = g_new0 (DMAPMdnsBrowserService, 1);
service->service_name = g_strdup (service_name);
service->name = name;
service->host = g_strdup (host);
diff --git a/libdmapsharing/dmap-mdns-browser-dnssd.c b/libdmapsharing/dmap-mdns-browser-dnssd.c
index a40c1c8..c2c0cf0 100644
--- a/libdmapsharing/dmap-mdns-browser-dnssd.c
+++ b/libdmapsharing/dmap-mdns-browser-dnssd.c
@@ -103,7 +103,7 @@ signal_service_added (ServiceContext *context)
DMAPMdnsBrowserService *service;
- service = g_new (DMAPMdnsBrowserService, 1);
+ service = g_new0 (DMAPMdnsBrowserService, 1);
// FIXME: The name and service_name variables need to be renamed.
// Wait until working on DACP because I think this is when
@@ -114,6 +114,7 @@ signal_service_added (ServiceContext *context)
service->port = context->service.port;
service->pair = g_strdup (context->service.pair);
service->password_protected = context->service.password_protected;
+ service->transport_protocol = DMAP_MDNS_BROWSER_TRANSPORT_PROTOCOL_TCP;
// add to the services list
context->browser->priv->services =
diff --git a/libdmapsharing/dmap-mdns-browser-howl.c b/libdmapsharing/dmap-mdns-browser-howl.c
index d4cd03d..d5c3a31 100644
--- a/libdmapsharing/dmap-mdns-browser-howl.c
+++ b/libdmapsharing/dmap-mdns-browser-howl.c
@@ -267,13 +267,15 @@ resolve_cb (sw_discovery discovery,
name = g_strdup (service_name);
}
- service = g_new (DMAPMdnsBrowserService, 1);
+ service = g_new0 (DMAPMdnsBrowserService, 1);
service->service_name = g_strdup (service_name);
service->name = name;
service->host = g_strdup (host);
service->port = port;
service->password_protected = pp;
service->pair = pair;
+ service->transport_protocol = DMAP_MDNS_BROWSER_TRANSPORT_PROTOCOL_TCP;
+
browser->priv->services =
g_slist_append (browser->priv->services, service);
diff --git a/libdmapsharing/dmap-mdns-publisher-avahi.c b/libdmapsharing/dmap-mdns-publisher-avahi.c
index 45d8594..488b5f8 100644
--- a/libdmapsharing/dmap-mdns-publisher-avahi.c
+++ b/libdmapsharing/dmap-mdns-publisher-avahi.c
@@ -284,7 +284,7 @@ dmap_mdns_publisher_publish (DMAPMdnsPublisher * publisher,
return FALSE;
}
- service = g_new (struct DMAPMdnsPublisherService, 1);
+ service = g_new0 (struct DMAPMdnsPublisherService, 1);
service->name = g_strdup (name);
service->port = port;
diff --git a/libdmapsharing/dmap-share.c b/libdmapsharing/dmap-share.c
index 96635ba..5c548e3 100644
--- a/libdmapsharing/dmap-share.c
+++ b/libdmapsharing/dmap-share.c
@@ -1786,8 +1786,9 @@ _dmap_share_databases (DMAPShare * share,
*/
/* 1: */
- share_bitwise = g_new (struct share_bitwise_t, 1);
+ share_bitwise = g_new0 (struct share_bitwise_t, 1);
+ share_bitwise->share = share;
share_bitwise->mb = mb;
share_bitwise->id_list = NULL;
share_bitwise->size = 0;
@@ -1809,7 +1810,6 @@ _dmap_share_databases (DMAPShare * share,
accumulate_mlcl_size_and_ids,
share_bitwise);
}
- share_bitwise->share = share;
/* 2: */
adbs = dmap_structure_add (NULL, DMAP_CC_ADBS);
diff --git a/libdmapsharing/dpap-share.c b/libdmapsharing/dpap-share.c
index 72ef344..cbe1922 100644
--- a/libdmapsharing/dpap-share.c
+++ b/libdmapsharing/dpap-share.c
@@ -514,7 +514,7 @@ send_chunked_file (SoupServer * server, SoupMessage * message,
GInputStream *stream;
const char *location;
GError *error = NULL;
- ChunkData *cd = g_new (ChunkData, 1);
+ ChunkData *cd = g_new0 (ChunkData, 1);
g_object_get (record, "location", &location, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]