[balsa/gtk3] Reduce scope of variables
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Reduce scope of variables
- Date: Sun, 22 Jul 2012 19:43:31 +0000 (UTC)
commit 09f9727698cd088a192eb94853c7fb9a80bb67de
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sun Jul 22 15:24:03 2012 -0400
Reduce scope of variables
* libbalsa/mailbox_imap.c (is_child_of), (create_cache_copy),
(libbalsa_mailbox_imap_sort): reduce scope of variables.
ChangeLog | 5 +++++
libbalsa/mailbox_imap.c | 17 ++++++++++-------
2 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 92d4c49..2fd3e22 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2012-07-22 Peter Bloomfield
+ * libbalsa/mailbox_imap.c (is_child_of), (create_cache_copy),
+ (libbalsa_mailbox_imap_sort): reduce scope of variables.
+
+2012-07-22 Peter Bloomfield
+
* libbalsa/mailbox.c (libbalsa_mailbox_type_from_path): reduce
scope of variable.
diff --git a/libbalsa/mailbox_imap.c b/libbalsa/mailbox_imap.c
index 7735bd0..0a088f3 100644
--- a/libbalsa/mailbox_imap.c
+++ b/libbalsa/mailbox_imap.c
@@ -2324,8 +2324,8 @@ is_child_of(LibBalsaMessageBody *body, LibBalsaMessageBody *child,
body->parts->body_type ==
LIBBALSA_MESSAGE_BODY_TYPE_MULTIPART);
if(is_child_of(body->parts, child, s, do_mod)){
- char buf[12];
if(modify) {
+ char buf[12];
snprintf(buf, sizeof(buf), "%u.", i);
g_string_prepend(s, buf);
}
@@ -2923,9 +2923,9 @@ create_cache_copy(const gchar *src, const gchar *cache_dir, const gchar *name)
if(in) {
FILE *out = fopen(dst, "w");
- char buf[65536];
- size_t sz;
if(out) {
+ size_t sz;
+ char buf[65536];
gboolean err;
while( (sz=fread(buf, 1, sizeof(buf), in)) > 0)
if(fwrite(buf, 1, sz, out) != sz)
@@ -3262,23 +3262,26 @@ lbmi_compare_func(const SortTuple * a,
static void
libbalsa_mailbox_imap_sort(LibBalsaMailbox *mbox, GArray *array)
{
- unsigned *msgno_arr, i;
- ImapResponse rc;
LibBalsaMailboxImap *mimap;
mimap = LIBBALSA_MAILBOX_IMAP(mbox);
if (mimap->sort_field != mbox->view->sort_field) {
/* Cached ranks are invalid. */
- guint len = mimap->messages_info->len;
+ unsigned *msgno_arr;
+ guint i, len;
+
+ len = mimap->messages_info->len;
msgno_arr = g_malloc(len * sizeof(unsigned));
for (i = 0; i < len; i++)
msgno_arr[i] = i + 1;
- if (mbox->view->sort_field != LB_MAILBOX_SORT_NO)
+ if (mbox->view->sort_field != LB_MAILBOX_SORT_NO) {
+ ImapResponse rc;
/* Server-side sort of the whole mailbox. */
II(rc, LIBBALSA_MAILBOX_IMAP(mbox)->handle,
imap_mbox_sort_msgno(LIBBALSA_MAILBOX_IMAP(mbox)->handle,
lbmi_get_imap_sort_key(mbox), TRUE,
msgno_arr, len)); /* ignore errors */
+ }
g_array_set_size(mimap->sort_ranks, len);
for (i = 0; i < len; i++)
g_array_index(mimap->sort_ranks, guint, msgno_arr[i] - 1) = i;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]