pidgin: eb585cf3: jabber: These uses of strlen() are unnec...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Fri Nov 6 05:01:05 EST 2009


-----------------------------------------------------------------
Revision: eb585cf3e68432a1921305374f13ee739363b09f
Ancestor: 724b6ea186d01194e2bcacb18d6b0cce228241ad
Author: darkrain42 at pidgin.im
Date: 2009-11-06T09:30:40
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/eb585cf3e68432a1921305374f13ee739363b09f

Modified files:
        libpurple/protocols/jabber/auth.c

ChangeLog: 

jabber: These uses of strlen() are unnecessary.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/auth.c	17cf45d90061543e3aa9c45d705c62e23aee6cf1
+++ libpurple/protocols/jabber/auth.c	85cf30bc7e172407b5ed40b20bacd120b94dbdea
@@ -381,13 +381,13 @@ static void jabber_auth_start_cyrus(Jabb
 				 * due to mechanism specific issues, so we want to try one of the other
 				 * supported mechanisms. This code handles that case
 				 */
-				if (js->current_mech && strlen(js->current_mech) > 0) {
+				if (js->current_mech && *js->current_mech) {
 					char *pos;
 					if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) {
 						g_string_erase(js->sasl_mechs, pos-js->sasl_mechs->str, strlen(js->current_mech));
 					}
 					/* Remove space which separated this mech from the next */
-					if (strlen(js->sasl_mechs->str) > 0 && ((js->sasl_mechs->str)[0] == ' ')) {
+					if ((js->sasl_mechs->str)[0] == ' ') {
 						g_string_erase(js->sasl_mechs, 0, 1);
 					}
 					again = TRUE;
@@ -1099,17 +1099,17 @@ void jabber_auth_handle_failure(JabberSt
 
 #ifdef HAVE_CYRUS_SASL
 	if(js->auth_fail_count++ < 5) {
-		if (js->current_mech && strlen(js->current_mech) > 0) {
+		if (js->current_mech && *js->current_mech) {
 			char *pos;
 			if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) {
 				g_string_erase(js->sasl_mechs, pos-js->sasl_mechs->str, strlen(js->current_mech));
 			}
 			/* Remove space which separated this mech from the next */
-			if (strlen(js->sasl_mechs->str) > 0 && ((js->sasl_mechs->str)[0] == ' ')) {
+			if ((js->sasl_mechs->str)[0] == ' ') {
 				g_string_erase(js->sasl_mechs, 0, 1);
 			}
 		}
-		if (strlen(js->sasl_mechs->str)) {
+		if (*js->sasl_mechs->str) {
 			/* If we have remaining mechs to try, do so */
 			sasl_dispose(&js->sasl);
 


More information about the Commits mailing list