diff libpurple/protocols/mxit/protocol.c @ 31905: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 93cb9f408df4
children 5d81b452dcc4 3828a61c44da
line wrap: on
line diff
--- a/libpurple/protocols/mxit/protocol.c	Mon Aug 22 01:53:37 2011 +0000
+++ b/libpurple/protocols/mxit/protocol.c	Mon Aug 22 02:07:41 2011 +0000
@@ -1648,7 +1648,7 @@
 
 		if ( rec->fcount >= 5 ) {
 			/* there is a personal invite message attached */
-			if ( ( rec->fields[4]->data ) && ( strlen( rec->fields[4]->data ) > 0 ) )
+			if ( ( rec->fields[4]->data ) && ( *rec->fields[4]->data ) )
 				contact->msg = strdup( rec->fields[4]->data );
 		}
 
@@ -1890,7 +1890,7 @@
 		contact = get_mxit_invite_contact( session, mxitId );
 		if ( contact ) {
 			/* this is an invite, so update its profile info */
-			if ( ( statusMsg ) && ( strlen( statusMsg ) > 0 ) ) {
+			if ( ( statusMsg ) && ( *statusMsg ) ) {
 				/* update the status message */
 				if ( contact->statusMsg )
 					g_free( contact->statusMsg );
@@ -1901,7 +1901,7 @@
 			if ( contact->profile )
 				g_free( contact->profile );
 			contact->profile = profile;
-			if ( ( avatarId ) && ( strlen( avatarId ) > 0 ) ) {
+			if ( ( avatarId ) && ( *avatarId ) ) {
 				/* avatar must be requested for this invite before we can display it */
 				mxit_get_avatar( session, mxitId, avatarId );
 				if ( contact->avatarId )
@@ -1919,7 +1919,7 @@
 			if ( avatarId )
 				mxit_update_buddy_avatar( session, mxitId, avatarId );
 
-			if ( ( statusMsg ) && ( strlen( statusMsg ) > 0 ) ) {
+			if ( ( statusMsg ) && ( *statusMsg ) ) {
 				/* update the status message */
 				PurpleBuddy*		buddy	= NULL;