summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Ferrandis <ludovic.ferrandis@intel.com>2013-03-21 12:05:58 +0100
committerMark Ryan <mark.d.ryan@intel.com>2013-03-29 10:14:34 +0100
commit2c463dfe990f0b5d5836df2ef04216f53b467679 (patch)
tree6f3f24fb251e229cae8b1264792d77b9e15754d8
parent4c19ed2c349e73fd35d9007a4f411e7ca2536218 (diff)
downloaddleyna-server-2c463dfe990f0b5d5836df2ef04216f53b467679.tar.gz
[Property] Code cleaning
Remove useless pointer check. Update prv_add_strv_prop to behave as other functions. Now it checks if 'value' parameter is not NULL. Signed-off-by: Ludovic Ferrandis <ludovic.ferrandis@intel.com>
-rw-r--r--libdleyna/server/props.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/libdleyna/server/props.c b/libdleyna/server/props.c
index 2dbd63b..947aac6 100644
--- a/libdleyna/server/props.c
+++ b/libdleyna/server/props.c
@@ -540,7 +540,7 @@ static void prv_add_string_prop(GVariantBuilder *vb, const gchar *key,
static void prv_add_strv_prop(GVariantBuilder *vb, const gchar *key,
const gchar **value, unsigned int len)
{
- if (len > 0)
+ if (value && *value && len > 0)
g_variant_builder_add(vb, "{sv}", key,
g_variant_new_strv(value, len));
}
@@ -1323,10 +1323,8 @@ static GVariant *prv_compute_resources(GUPnPDIDLLiteObject *object,
res_vb = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
if (filter_mask & DLS_UPNP_MASK_PROP_URL) {
str_val = gupnp_didl_lite_resource_get_uri(res);
- if (str_val)
- prv_add_string_prop(res_vb,
- DLS_INTERFACE_PROP_URL,
- str_val);
+ prv_add_string_prop(res_vb, DLS_INTERFACE_PROP_URL,
+ str_val);
}
prv_parse_resources(res_vb, res, filter_mask);
g_variant_builder_add(res_array_vb, "@a{sv}",
@@ -1417,10 +1415,8 @@ void dls_props_add_item(GVariantBuilder *item_vb,
if (res) {
if (filter_mask & DLS_UPNP_MASK_PROP_URLS) {
str_val = gupnp_didl_lite_resource_get_uri(res);
- if (str_val)
- prv_add_strv_prop(item_vb,
- DLS_INTERFACE_PROP_URLS,
- &str_val, 1);
+ prv_add_strv_prop(item_vb, DLS_INTERFACE_PROP_URLS,
+ &str_val, 1);
}
prv_parse_resources(item_vb, res, filter_mask);
g_object_unref(res);
@@ -1442,10 +1438,8 @@ void dls_props_add_resource(GVariantBuilder *item_vb,
if (res) {
if (filter_mask & DLS_UPNP_MASK_PROP_URL) {
str_val = gupnp_didl_lite_resource_get_uri(res);
- if (str_val)
- prv_add_string_prop(item_vb,
- DLS_INTERFACE_PROP_URL,
- str_val);
+ prv_add_string_prop(item_vb, DLS_INTERFACE_PROP_URL,
+ str_val);
}
prv_parse_resources(item_vb, res, filter_mask);
g_object_unref(res);