Commit 96b7100a authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

var_CreateGetNEString simplications

parent 528f0214
......@@ -321,17 +321,15 @@ net_IPv4Join (vlc_object_t *obj, int fd,
socklen_t optlen;
/* Multicast interface IPv4 address */
char *iface = var_CreateGetString (obj, "miface-addr");
if (iface != NULL)
{
if ((*iface)
char *iface = var_CreateGetNonEmptyString (obj, "miface-addr");
if ((iface != NULL)
&& (inet_pton (AF_INET, iface, &id) <= 0))
{
msg_Err (obj, "invalid multicast interface address %s", iface);
free (iface);
goto error;
}
}
free (iface);
memset (&opt, 0, sizeof (opt));
if (src != NULL)
......@@ -428,10 +426,8 @@ net_SourceSubscribe (vlc_object_t *obj, int fd,
{
int level, iid = 0;
char *iface = var_CreateGetString (obj, "miface");
char *iface = var_CreateGetNonEmptyString (obj, "miface");
if (iface != NULL)
{
if (*iface)
{
iid = if_nametoindex (iface);
if (iid == 0)
......@@ -440,7 +436,6 @@ net_SourceSubscribe (vlc_object_t *obj, int fd,
free (iface);
return -1;
}
}
free (iface);
}
......@@ -661,18 +656,16 @@ int __net_ConnectDgram( vlc_object_t *p_this, const char *psz_host, int i_port,
if( i_hlim > 0 )
net_SetMcastHopLimit( p_this, fd, ptr->ai_family, i_hlim );
str = var_CreateGetString (p_this, "miface");
str = var_CreateGetNonEmptyString (p_this, "miface");
if (str != NULL)
{
if (*str)
net_SetMcastOut (p_this, fd, ptr->ai_family, str, NULL);
free (str);
}
str = var_CreateGetString (p_this, "miface-addr");
str = var_CreateGetNonEmptyString (p_this, "miface-addr");
if (str != NULL)
{
if (*str)
net_SetMcastOut (p_this, fd, ptr->ai_family, NULL, str);
free (str);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment