Mercurial > pidgin
comparison libpurple/protocols/jabber/auth.c @ 28519:18b64ff28354
jabber: These uses of strlen() are unnecessary.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Fri, 06 Nov 2009 09:30:40 +0000 |
parents | 46fd79aa46c5 |
children | 682b441d4944 |
comparison
equal
deleted
inserted
replaced
28518:46fd79aa46c5 | 28519:18b64ff28354 |
---|---|
379 * SXW: Yes, this is right. What this handles is the situation where a | 379 * SXW: Yes, this is right. What this handles is the situation where a |
380 * mechanism, say GSSAPI, is tried. If that mechanism fails, it may be | 380 * mechanism, say GSSAPI, is tried. If that mechanism fails, it may be |
381 * due to mechanism specific issues, so we want to try one of the other | 381 * due to mechanism specific issues, so we want to try one of the other |
382 * supported mechanisms. This code handles that case | 382 * supported mechanisms. This code handles that case |
383 */ | 383 */ |
384 if (js->current_mech && strlen(js->current_mech) > 0) { | 384 if (js->current_mech && *js->current_mech) { |
385 char *pos; | 385 char *pos; |
386 if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) { | 386 if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) { |
387 g_string_erase(js->sasl_mechs, pos-js->sasl_mechs->str, strlen(js->current_mech)); | 387 g_string_erase(js->sasl_mechs, pos-js->sasl_mechs->str, strlen(js->current_mech)); |
388 } | 388 } |
389 /* Remove space which separated this mech from the next */ | 389 /* Remove space which separated this mech from the next */ |
390 if (strlen(js->sasl_mechs->str) > 0 && ((js->sasl_mechs->str)[0] == ' ')) { | 390 if ((js->sasl_mechs->str)[0] == ' ') { |
391 g_string_erase(js->sasl_mechs, 0, 1); | 391 g_string_erase(js->sasl_mechs, 0, 1); |
392 } | 392 } |
393 again = TRUE; | 393 again = TRUE; |
394 } | 394 } |
395 | 395 |
1097 PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; | 1097 PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
1098 char *msg; | 1098 char *msg; |
1099 | 1099 |
1100 #ifdef HAVE_CYRUS_SASL | 1100 #ifdef HAVE_CYRUS_SASL |
1101 if(js->auth_fail_count++ < 5) { | 1101 if(js->auth_fail_count++ < 5) { |
1102 if (js->current_mech && strlen(js->current_mech) > 0) { | 1102 if (js->current_mech && *js->current_mech) { |
1103 char *pos; | 1103 char *pos; |
1104 if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) { | 1104 if ((pos = strstr(js->sasl_mechs->str, js->current_mech))) { |
1105 g_string_erase(js->sasl_mechs, pos-js->sasl_mechs->str, strlen(js->current_mech)); | 1105 g_string_erase(js->sasl_mechs, pos-js->sasl_mechs->str, strlen(js->current_mech)); |
1106 } | 1106 } |
1107 /* Remove space which separated this mech from the next */ | 1107 /* Remove space which separated this mech from the next */ |
1108 if (strlen(js->sasl_mechs->str) > 0 && ((js->sasl_mechs->str)[0] == ' ')) { | 1108 if ((js->sasl_mechs->str)[0] == ' ') { |
1109 g_string_erase(js->sasl_mechs, 0, 1); | 1109 g_string_erase(js->sasl_mechs, 0, 1); |
1110 } | 1110 } |
1111 } | 1111 } |
1112 if (strlen(js->sasl_mechs->str)) { | 1112 if (*js->sasl_mechs->str) { |
1113 /* If we have remaining mechs to try, do so */ | 1113 /* If we have remaining mechs to try, do so */ |
1114 sasl_dispose(&js->sasl); | 1114 sasl_dispose(&js->sasl); |
1115 | 1115 |
1116 jabber_auth_start_cyrus(js); | 1116 jabber_auth_start_cyrus(js); |
1117 return; | 1117 return; |