comparison libpurple/upnp.c @ 32364:323876c34a96

Don't use strlen() when all you're trying to do is check if the string is empty
author Mark Doliner <mark@kingant.net>
date Mon, 22 Aug 2011 02:07:41 +0000
parents 7df08e88d9bb
children 904686722499
comparison
equal deleted inserted replaced
32363:3322201b446f 32364:323876c34a96
742 const gchar * 742 const gchar *
743 purple_upnp_get_public_ip() 743 purple_upnp_get_public_ip()
744 { 744 {
745 if (control_info.status == PURPLE_UPNP_STATUS_DISCOVERED 745 if (control_info.status == PURPLE_UPNP_STATUS_DISCOVERED
746 && control_info.publicip 746 && control_info.publicip
747 && strlen(control_info.publicip) > 0) 747 && *control_info.publicip)
748 return control_info.publicip; 748 return control_info.publicip;
749 749
750 /* Trigger another UPnP discovery if 5 minutes have elapsed since the 750 /* Trigger another UPnP discovery if 5 minutes have elapsed since the
751 * last one, and it wasn't successful */ 751 * last one, and it wasn't successful */
752 if (control_info.status < PURPLE_UPNP_STATUS_DISCOVERING 752 if (control_info.status < PURPLE_UPNP_STATUS_DISCOVERING
801 static const gchar * 801 static const gchar *
802 purple_upnp_get_internal_ip(void) 802 purple_upnp_get_internal_ip(void)
803 { 803 {
804 if (control_info.status == PURPLE_UPNP_STATUS_DISCOVERED 804 if (control_info.status == PURPLE_UPNP_STATUS_DISCOVERED
805 && control_info.internalip 805 && control_info.internalip
806 && strlen(control_info.internalip) > 0) 806 && *control_info.internalip)
807 return control_info.internalip; 807 return control_info.internalip;
808 808
809 /* Trigger another UPnP discovery if 5 minutes have elapsed since the 809 /* Trigger another UPnP discovery if 5 minutes have elapsed since the
810 * last one, and it wasn't successful */ 810 * last one, and it wasn't successful */
811 if (control_info.status < PURPLE_UPNP_STATUS_DISCOVERING 811 if (control_info.status < PURPLE_UPNP_STATUS_DISCOVERING