pidgin: a1a2c1d1: Don't count the size of an array at runt...
elb at pidgin.im
elb at pidgin.im
Wed Apr 30 13:05:50 EDT 2008
-----------------------------------------------------------------
Revision: a1a2c1d11debe187752f68d57a72ab9715d2fd43
Ancestor: 018afa661b9c72b48f2277e33e2fe55cc8b19235
Author: elb at pidgin.im
Date: 2008-04-30T17:00:27
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/a1a2c1d11debe187752f68d57a72ab9715d2fd43
Modified files:
libpurple/protocols/jabber/usermood.c
ChangeLog:
Don't count the size of an array at runtime if it's known at compile time.
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/usermood.c edfc1e040b5419291c7ad4d30df3a47f046b2cd0
+++ libpurple/protocols/jabber/usermood.c a5f486606cd6c1400ac958b09919bfc0780578ce
@@ -147,7 +147,7 @@ static void do_mood_set_from_fields(Purp
static void do_mood_set_from_fields(PurpleConnection *gc, PurpleRequestFields *fields) {
JabberStream *js;
- int max_mood_idx;
+ const int max_mood_idx = sizeof(moodstrings) / sizeof(moodstrings[0]) - 1;
int selected_mood = purple_request_fields_get_choice(fields, "mood");
if (!PURPLE_CONNECTION_IS_VALID(gc)) {
@@ -157,9 +157,6 @@ static void do_mood_set_from_fields(Purp
js = gc->proto_data;
- /* This is ugly, but protects us from unexpected values. */
- for (max_mood_idx = 0; moodstrings[max_mood_idx]; max_mood_idx++);
-
if (selected_mood < 0 || selected_mood >= max_mood_idx) {
purple_debug_error("jabber", "Invalid mood index (%d) selected.\n", selected_mood);
return;
More information about the Commits
mailing list