comparison libpurple/protocols/null/nullprpl.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 3322201b446f
children e8d4755ef84b
comparison
equal deleted inserted replaced
32363:3322201b446f 32364:323876c34a96
232 PurpleStatus *status = purple_presence_get_active_status(presence); 232 PurpleStatus *status = purple_presence_get_active_status(presence);
233 const char *name = purple_status_get_name(status); 233 const char *name = purple_status_get_name(status);
234 const char *message = purple_status_get_attr_string(status, "message"); 234 const char *message = purple_status_get_attr_string(status, "message");
235 235
236 char *text; 236 char *text;
237 if (message && strlen(message) > 0) 237 if (message && *message)
238 text = g_strdup_printf("%s: %s", name, message); 238 text = g_strdup_printf("%s: %s", name, message);
239 else 239 else
240 text = g_strdup(name); 240 text = g_strdup(name);
241 241
242 purple_debug_info("nullprpl", "%s's status text is %s\n", buddy->name, text); 242 purple_debug_info("nullprpl", "%s's status text is %s\n", buddy->name, text);
931 const char *username = from->conv->account->username; 931 const char *username = from->conv->account->username;
932 char *msg; 932 char *msg;
933 933
934 purple_conv_chat_set_topic(to, username, topic); 934 purple_conv_chat_set_topic(to, username, topic);
935 935
936 if (topic && strlen(topic) > 0) 936 if (topic && *topic)
937 msg = g_strdup_printf(_("%s sets topic to: %s"), username, topic); 937 msg = g_strdup_printf(_("%s sets topic to: %s"), username, topic);
938 else 938 else
939 msg = g_strdup_printf(_("%s clears topic"), username); 939 msg = g_strdup_printf(_("%s clears topic"), username);
940 940
941 purple_conv_chat_write(to, username, msg, 941 purple_conv_chat_write(to, username, msg,