# HG changeset patch # User Mark Doliner # Date 1313979096 0 # Node ID e8d4755ef84b5d05e62011503e575a182734adcb # Parent 323876c34a960c729c6329c0c8a390cbd3b3d5a2 Don't use strlen() when you're just checking whether a string is empty diff -r 323876c34a96 -r e8d4755ef84b libpurple/protocols/gg/buddylist.c --- a/libpurple/protocols/gg/buddylist.c Mon Aug 22 02:07:41 2011 +0000 +++ b/libpurple/protocols/gg/buddylist.c Mon Aug 22 02:11:36 2011 +0000 @@ -90,7 +90,7 @@ gchar **data_tbl; gchar *name, *show, *g; - if (strlen(users_tbl[i]) == 0) + if (!*users_tbl[i]) continue; data_tbl = g_strsplit(users_tbl[i], ";", 8); diff -r 323876c34a96 -r e8d4755ef84b libpurple/protocols/mxit/login.c --- a/libpurple/protocols/mxit/login.c Mon Aug 22 02:07:41 2011 +0000 +++ b/libpurple/protocols/mxit/login.c Mon Aug 22 02:11:36 2011 +0000 @@ -743,7 +743,7 @@ * if we don't have any info saved from a previous login, we need to get it from the MXit WAP site. * we do cache it, so this step is only done on the very first login for each account. */ - if ( ( session->distcode == NULL ) || ( strlen( session->distcode ) == 0 ) ) { + if ( ( session->distcode == NULL ) || ( !*session->distcode ) ) { /* this must be the very first login, so we need to retrieve the user information */ get_clientinfo( session ); } diff -r 323876c34a96 -r e8d4755ef84b libpurple/protocols/mxit/profile.c --- a/libpurple/protocols/mxit/profile.c Mon Aug 22 02:07:41 2011 +0000 +++ b/libpurple/protocols/mxit/profile.c Mon Aug 22 02:11:36 2011 +0000 @@ -115,7 +115,7 @@ struct tm now, bdate; int age; - if ( ( !date ) || ( strlen( date ) == 0 ) ) + if ( ( !date ) || ( !*date ) ) return 0; /* current time */ diff -r 323876c34a96 -r e8d4755ef84b libpurple/protocols/mxit/voicevideo.c --- a/libpurple/protocols/mxit/voicevideo.c Mon Aug 22 02:07:41 2011 +0000 +++ b/libpurple/protocols/mxit/voicevideo.c Mon Aug 22 02:11:36 2011 +0000 @@ -71,7 +71,7 @@ purple_debug_info(MXIT_PLUGIN_ID, "mxit_media_caps: buddy '%s'\n", who); /* We need to have a voice/video server */ - if (strlen(session->voip_server) == 0) + if (!*session->voip_server) return PURPLE_MEDIA_CAPS_NONE; /* find the buddy information for this contact (reference: "libpurple/blist.h") */ diff -r 323876c34a96 -r e8d4755ef84b libpurple/protocols/null/nullprpl.c --- a/libpurple/protocols/null/nullprpl.c Mon Aug 22 02:07:41 2011 +0000 +++ b/libpurple/protocols/null/nullprpl.c Mon Aug 22 02:11:36 2011 +0000 @@ -781,10 +781,10 @@ to_username = args[0]; message = args[1]; - if (!to_username || strlen(to_username) == 0) { + if (!to_username || !*to_username) { *error = g_strdup(_("Whisper is missing recipient.")); return PURPLE_CMD_RET_FAILED; - } else if (!message || strlen(message) == 0) { + } else if (!message || !*message) { *error = g_strdup(_("Whisper is missing message.")); return PURPLE_CMD_RET_FAILED; } diff -r 323876c34a96 -r e8d4755ef84b libpurple/protocols/zephyr/zephyr.c --- a/libpurple/protocols/zephyr/zephyr.c Mon Aug 22 02:07:41 2011 +0000 +++ b/libpurple/protocols/zephyr/zephyr.c Mon Aug 22 02:11:36 2011 +0000 @@ -1164,7 +1164,7 @@ locations = find_node(newparsetree,"locations"); locval = tree_child(tree_child(tree_child(tree_child(locations,2),0),0),2)->contents; - if (!locval || !g_ascii_strcasecmp(locval," ") || (strlen(locval) == 0)) { + if (!locval || !g_ascii_strcasecmp(locval," ") || !*locval) { nlocs = 0; } else { nlocs = 1; diff -r 323876c34a96 -r e8d4755ef84b pidgin/gtkconv.c --- a/pidgin/gtkconv.c Mon Aug 22 02:07:41 2011 +0000 +++ b/pidgin/gtkconv.c Mon Aug 22 02:11:36 2011 +0000 @@ -578,7 +578,7 @@ gtk_widget_grab_focus(gtkconv->entry); - if (strlen(clean) == 0) { + if (!*clean) { g_free(buf); g_free(clean); return;