[balsa/gtk3] Reduce scope of variables



commit 7c7f33140fd6539a5f0916169163d446259b2f3a
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Jul 22 15:13:47 2012 -0400

    Reduce scope of variables
    
    	* libbalsa/imap/imap_search.c (imap_search_key_new_string),
    	(imap_search_exec_unlocked): reduce scope of variables.

 ChangeLog                   |    5 +++++
 libbalsa/imap/imap_search.c |   15 +++++++++------
 2 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7d63dde..c7e624e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-07-22  Peter Bloomfield
 
+	* libbalsa/imap/imap_search.c (imap_search_key_new_string),
+	(imap_search_exec_unlocked): reduce scope of variables.
+
+2012-07-22  Peter Bloomfield
+
 	* libbalsa/imap/imap-tls.c (imap_check_server_identity): reduce
 	scope of variable.
 
diff --git a/libbalsa/imap/imap_search.c b/libbalsa/imap/imap_search.c
index 7d882df..ff31e0d 100644
--- a/libbalsa/imap/imap_search.c
+++ b/libbalsa/imap/imap_search.c
@@ -103,16 +103,17 @@ imap_search_key_new_string(unsigned negated, ImapSearchHeader hdr,
                            const char *string, const char *user_hdr)
 {
   ImapSearchKey *s = g_new(ImapSearchKey,1);
-  int i;
   s->next = NULL;
   s->type = IMSE_STRING;
   s->negated = negated;
   s->d.string.hdr = hdr;
   s->d.string.usr = (user_hdr && *user_hdr) ? g_strdup(user_hdr) : NULL;
   s->d.string.s = g_strdup(string);
-  if(s->d.string.usr)
+  if(s->d.string.usr) {
+    int i;
     for(i=strlen(s->d.string.usr)-1; i>=0; i--)
       if(!IS_ATOM_CHAR(s->d.string.usr[i])) s->d.string.usr[i] = '_';
+  }
   return s;
 }
 
@@ -470,9 +471,6 @@ ImapResponse
 imap_search_exec_unlocked(ImapMboxHandle *h, gboolean uid, 
 			  ImapSearchKey *s, ImapSearchCb cb, void *cb_arg)
 {
-  static const unsigned BODY_TO_SEARCH_AT_ONCE   = 500000;
-  static const unsigned HEADER_TO_SEARCH_AT_ONCE = 2000;
-  static const unsigned UIDS_TO_SEARCH_AT_ONCE   = 100000;
   int can_do_literals =
     imap_mbox_handle_can_do(h, IMCAP_LITERAL);
 
@@ -485,7 +483,7 @@ imap_search_exec_unlocked(ImapMboxHandle *h, gboolean uid,
   ImapCmdTag tag;
   ImapSearchCb ocb;
   void *oarg;
-  unsigned cmdno, lo, delta;
+  unsigned cmdno;
   const gchar *cmd_string;
   gboolean split;
 
@@ -509,11 +507,16 @@ imap_search_exec_unlocked(ImapMboxHandle *h, gboolean uid,
 
   split = imap_search_checks(s, IMSE_SEQUENCE);
   if(split) {
+    unsigned delta, lo;
+
     if(imap_search_checks_body(s)) {
+      static const unsigned BODY_TO_SEARCH_AT_ONCE   = 500000;
       delta = BODY_TO_SEARCH_AT_ONCE;
     } else if(imap_search_checks(s, IMSE_STRING)) {
+      static const unsigned HEADER_TO_SEARCH_AT_ONCE = 2000;
       delta = HEADER_TO_SEARCH_AT_ONCE;
     } else {
+      static const unsigned UIDS_TO_SEARCH_AT_ONCE   = 100000;
       delta = UIDS_TO_SEARCH_AT_ONCE;
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]