aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-10-25 05:55:54 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-10-27 21:25:01 +0800
commit58166e645971a4812fef23702f45cacc8e64e419 (patch)
treebedad70e39e2215a53105e0303c168e86140371a /mail
parentc58b70659747967568a536e217b9440424709f92 (diff)
downloadgsoc2013-evolution-58166e645971a4812fef23702f45cacc8e64e419.tar
gsoc2013-evolution-58166e645971a4812fef23702f45cacc8e64e419.tar.gz
gsoc2013-evolution-58166e645971a4812fef23702f45cacc8e64e419.tar.bz2
gsoc2013-evolution-58166e645971a4812fef23702f45cacc8e64e419.tar.lz
gsoc2013-evolution-58166e645971a4812fef23702f45cacc8e64e419.tar.xz
gsoc2013-evolution-58166e645971a4812fef23702f45cacc8e64e419.tar.zst
gsoc2013-evolution-58166e645971a4812fef23702f45cacc8e64e419.zip
Prefer G_N_ELEMENTS over sizeof calculations.
Diffstat (limited to 'mail')
-rw-r--r--mail/e-searching-tokenizer.c2
-rw-r--r--mail/em-account-editor.c14
-rw-r--r--mail/em-folder-properties.c4
-rw-r--r--mail/em-format-html-display.c4
-rw-r--r--mail/em-vfolder-rule.c4
-rw-r--r--mail/message-list.c8
-rw-r--r--mail/message-tag-followup.c4
7 files changed, 18 insertions, 22 deletions
diff --git a/mail/e-searching-tokenizer.c b/mail/e-searching-tokenizer.c
index aac8a0a34f..4a3b6a9bac 100644
--- a/mail/e-searching-tokenizer.c
+++ b/mail/e-searching-tokenizer.c
@@ -122,7 +122,7 @@ ignore_tag (const gchar *tag)
}
*out = 0;
- for (i=0;i<sizeof(ignored_tags)/sizeof(ignored_tags[0]);i++) {
+ for (i = 0; i < G_N_ELEMENTS (ignored_tags); i++) {
if (strcmp (t, ignored_tags[i]) == 0)
return 1;
}
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 5b96a5f5b5..e46695e2d6 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -493,8 +493,6 @@ static struct {
{ N_("SSL encryption"), "always" }
};
-#define num_ssl_options (sizeof (ssl_options) / sizeof (ssl_options[0]))
-
static gboolean
is_email (const gchar *address)
{
@@ -689,7 +687,7 @@ em_account_editor_ssl_selector_new (gchar *widget_name, gchar *string1, gchar *s
store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
- for (i=0;i<num_ssl_options;i++) {
+ for (i=0;i<G_N_ELEMENTS (ssl_options);i++) {
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, _(ssl_options[i].label), 1, ssl_options[i].value, -1);
}
@@ -1586,7 +1584,7 @@ emae_service_provider_changed (EMAccountEditorService *service)
hide = CAMEL_PROVIDER_HIDDEN(service->provider, info->flag);
show = (enable && !hide)?gtk_widget_show:gtk_widget_hide;
- for (j=0; j < sizeof (info->widgets)/sizeof (info->widgets[0]); j++) {
+ for (j=0; j < G_N_ELEMENTS (info->widgets); j++) {
if (info->widgets[j] && (w = G_STRUCT_MEMBER(GtkWidget *, service, info->widgets[j]))) {
show (w);
if (j == 0) {
@@ -1777,7 +1775,7 @@ emae_refresh_providers (EMAccountEditor *emae, EMAccountEditorService *service)
tmp = camel_url_get_param (url, "use_ssl");
if (tmp == NULL)
tmp = "never";
- for (i=0;i<num_ssl_options;i++) {
+ for (i=0;i<G_N_ELEMENTS (ssl_options);i++) {
if (!strcmp (ssl_options[i].value, tmp)) {
gtk_combo_box_set_active (service->use_ssl, i);
break;
@@ -2018,7 +2016,7 @@ emae_setup_service (EMAccountEditor *emae, EMAccountEditorService *service, Glad
if (tmp == NULL)
tmp = "never";
- for (i=0;i<num_ssl_options;i++) {
+ for (i=0;i<G_N_ELEMENTS (ssl_options);i++) {
if (!strcmp (ssl_options[i].value, tmp)) {
gtk_combo_box_set_active (service->use_ssl, i);
break;
@@ -2152,7 +2150,7 @@ emae_queue_widgets (EMAccountEditor *emae, GladeXML *xml, const gchar *first, ..
}
va_end (ap);
- g_return_if_fail (i < sizeof (emae->priv->widgets)/sizeof (emae->priv->widgets[0]));
+ g_return_if_fail (i < G_N_ELEMENTS (emae->priv->widgets));
emae->priv->widgets[i] = NULL;
emae->priv->widgets_index = 0;
@@ -2181,7 +2179,7 @@ emae_identity_page (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget
g_free (gladefile);
/* Management & Identity fields, in the assistant the management frame is relocated to the last page later on */
- for (i=0;i<sizeof (emae_identity_entries)/sizeof (emae_identity_entries[0]);i++)
+ for (i=0;i<G_N_ELEMENTS (emae_identity_entries);i++)
gui->identity_entries[i] = emae_account_entry (emae, emae_identity_entries[i].name, emae_identity_entries[i].item, xml);
gui->management_frame = glade_xml_get_widget (xml, "management_frame");
diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c
index a7236e66dd..7b7957149c 100644
--- a/mail/em-folder-properties.c
+++ b/mail/em-folder-properties.c
@@ -357,7 +357,7 @@ emfp_dialog_got_folder_quota (CamelFolder *folder,
|| !strcmp(prop_data->name, "Sent"))) {
emfp_items[EMFP_FOLDER_SECTION].label = _(prop_data->name);
if (!emfp_items_translated) {
- for (i=0;i<sizeof(emfp_items)/sizeof(emfp_items[0]);i++) {
+ for (i = 0; i < G_N_ELEMENTS (emfp_items); i++) {
if (emfp_items[i].label)
emfp_items[i].label = _(emfp_items[i].label);
}
@@ -415,7 +415,7 @@ emfp_dialog_got_folder_quota (CamelFolder *folder,
ec = em_config_new(E_CONFIG_BOOK, "org.gnome.evolution.mail.folderConfig");
prop_data->config = ec;
l = NULL;
- for (i=0;i<sizeof(emfp_items)/sizeof(emfp_items[0]);i++)
+ for (i = 0; i < G_N_ELEMENTS (emfp_items); i++)
l = g_slist_prepend(l, &emfp_items[i]);
e_config_add_items((EConfig *)ec, l, emfp_commit, NULL, emfp_free, prop_data);
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 46241186aa..6a2f56525c 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -731,7 +731,7 @@ efhd_builtin_init(EMFormatHTMLDisplayClass *efhc)
{
gint i;
- for (i=0;i<sizeof(type_builtin_table)/sizeof(type_builtin_table[0]);i++)
+ for (i = 0; i < G_N_ELEMENTS (type_builtin_table); i++)
em_format_class_add_handler((EMFormatClass *)efhc, &type_builtin_table[i]);
}
@@ -1036,7 +1036,7 @@ efhd_attachment_image(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObjec
camel_strdown(simple_type);
drag_types[0].target = simple_type;
- gtk_drag_source_set(box, GDK_BUTTON1_MASK, drag_types, sizeof(drag_types)/sizeof(drag_types[0]), GDK_ACTION_COPY);
+ gtk_drag_source_set(box, GDK_BUTTON1_MASK, drag_types, G_N_ELEMENTS (drag_types), GDK_ACTION_COPY);
g_free(simple_type);
g_signal_connect(box, "drag-data-get", G_CALLBACK(efhd_drag_data_get), pobject);
diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c
index 2ccbe1378d..3a87c09751 100644
--- a/mail/em-vfolder-rule.c
+++ b/mail/em-vfolder-rule.c
@@ -258,7 +258,7 @@ xml_encode(FilterRule *fr)
node = FILTER_RULE_CLASS(parent_class)->xml_encode(fr);
g_return_val_if_fail (node != NULL, NULL);
- g_return_val_if_fail (vr->with < sizeof(with_names)/sizeof(with_names[0]), NULL);
+ g_return_val_if_fail (vr->with < G_N_ELEMENTS (with_names), NULL);
set = xmlNewNode(NULL, (const guchar *)"sources");
xmlAddChild(node, set);
@@ -279,7 +279,7 @@ set_with(EMVFolderRule *vr, const gchar *name)
{
gint i;
- for (i=0;i<sizeof(with_names)/sizeof(with_names[0]);i++) {
+ for (i = 0; i < G_N_ELEMENTS (with_names); i++) {
if (!strcmp(name, with_names[i])) {
vr->with = i;
return;
diff --git a/mail/message-list.c b/mail/message-list.c
index c45dbf3437..90c0812aff 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -2213,7 +2213,7 @@ ml_tree_drag_motion(ETree *tree, GdkDragContext *context, gint x, gint y, guint
gint i;
d(printf("atom drop '%s'\n", gdk_atom_name(targets->data)));
- for (i=0;i<sizeof(ml_drag_info)/sizeof(ml_drag_info[0]);i++)
+ for (i = 0; i < G_N_ELEMENTS (ml_drag_info); i++)
if (targets->data == (gpointer)ml_drag_info[i].atom)
actions |= ml_drag_info[i].actions;
}
@@ -2488,7 +2488,7 @@ message_list_class_init (MessageListClass *class)
GtkObjectClass *gtk_object_class;
gint i;
- for (i=0;i<sizeof(ml_drag_info)/sizeof(ml_drag_info[0]);i++)
+ for (i = 0; i < G_N_ELEMENTS (ml_drag_info); i++)
ml_drag_info[i].atom = gdk_atom_intern(ml_drag_info[i].target, FALSE);
g_type_class_add_private (class, sizeof (MessageListPrivate));
@@ -2640,14 +2640,14 @@ message_list_construct (MessageList *message_list)
G_CALLBACK (on_selection_changed_cmd), message_list);
e_tree_drag_source_set(message_list->tree, GDK_BUTTON1_MASK,
- ml_drag_types, sizeof(ml_drag_types)/sizeof(ml_drag_types[0]),
+ ml_drag_types, G_N_ELEMENTS (ml_drag_types),
GDK_ACTION_MOVE|GDK_ACTION_COPY);
g_signal_connect(message_list->tree, "tree_drag_data_get",
G_CALLBACK(ml_tree_drag_data_get), message_list);
e_tree_drag_dest_set(message_list->tree, GTK_DEST_DEFAULT_ALL,
- ml_drop_types, sizeof(ml_drop_types)/sizeof(ml_drop_types[0]),
+ ml_drop_types, G_N_ELEMENTS (ml_drop_types),
GDK_ACTION_MOVE|GDK_ACTION_COPY);
g_signal_connect(message_list->tree, "tree_drag_data_received",
diff --git a/mail/message-tag-followup.c b/mail/message-tag-followup.c
index 5141387b01..b9ae183f6b 100644
--- a/mail/message-tag-followup.c
+++ b/mail/message-tag-followup.c
@@ -64,8 +64,6 @@ static const gchar *available_flags[] = {
N_("Review"),
};
-static gint num_available_flags = sizeof (available_flags) / sizeof (available_flags[0]);
-
static MessageTagEditorClass *parent_class = NULL;
GType
@@ -307,7 +305,7 @@ construct (MessageTagEditor *editor)
followup->combo_entry = GTK_COMBO_BOX (glade_xml_get_widget (gui, "combo"));
gtk_list_store_clear (GTK_LIST_STORE (gtk_combo_box_get_model (followup->combo_entry)));
- for (i = 0; i < num_available_flags; i++)
+ for (i = 0; i < G_N_ELEMENTS (available_flags); i++)
gtk_combo_box_append_text (followup->combo_entry, (gchar *) _(available_flags[i]));
gtk_combo_box_set_active (followup->combo_entry, DEFAULT_FLAG);