On 05/10/2017 03:23, Rosen Penev wrote:
@@ -1239,7 +1238,7 @@ static struct serverfd *allocate_sfd(union mysockaddr 
*addr, char *intname)
  #endif
      }
- if (intname && strlen(intname) != 0)
+  if (!strlen(intname))
      ifindex = if_nametoindex(intname); /* index == 0 when not binding to an 
interface */
/* may have a suitable one already */



I have no comment on the functionality of the patch (it if intname needs to be NULL checked or not), but this is not a good use of strlen.

This could be re-written as

if (*intname != '\0')

Which saves a function call because the actual length of the string is not used.

Roy

_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss

Reply via email to