<<< Date Index >>>     <<< Thread Index >>>

Re: [PATCH] runtime configurable buffy size



On Wed, Mar 14, 2007 at 11:15:27PM -0700, Brendan Cully wrote:
> On Thursday, 01 March 2007 at 16:23, Miroslav Lichvar wrote:
> > Ok, here is a patch that removes buffy_size completely and adds the
> > check_box_size option.
> 
> Looks nice, thanks. But...

Thanks for looking into this.

> > Index: commands.c
> > @@ -842,11 +837,9 @@
> >  
> >      if (need_buffy_cleanup)
> >      {
> > -#ifdef BUFFY_SIZE
> >        tmp = mutt_find_mailbox (buf);
> >        if (tmp && !tmp->new)
> >     mutt_update_mailbox (tmp);
> > -#else
> >        /* fix up the times so buffy won't get confused */
> >        if (st.st_mtime > st.st_atime)
> >        {
> > @@ -856,7 +849,6 @@
> >        }
> >        else
> >     utime (buf, NULL);
> > -#endif
> >      }
> 
> this looks a little like it should be a conditional on
> option(CHECKMBOXSIZE).

I think it's ok either way. Without the conditional it's a bit
closer to allowing runtime switching of the option and not losing
new mail flags on the mailboxes.

> > Index: mx.c
> > @@ -436,7 +430,7 @@
> >      else if (mutt_strcmp (MMDF_SEP, tmp) == 0)
> >        magic = M_MMDF;
> >      safe_fclose (&f);
> > -#ifndef BUFFY_SIZE
> > +
> >      /* need to restore the times here, the file was not really accessed,
> >       * only the type was accessed.  This is important, because detection
> >       * of "new mail" depends on those times set correctly.
> > @@ -444,7 +438,6 @@
> >      times.actime = st.st_atime;
> >      times.modtime = st.st_mtime;
> >      utime (path, &times);
> > -#endif
> >    }
> >    else
> >    {

Same as the first case.

> > @@ -786,9 +777,7 @@
> >      case M_MBOX:
> >      case M_MMDF:
> >        rc = mbox_sync_mailbox (ctx, index_hint);
> > -#ifdef BUFFY_SIZE
> >        tmp = mutt_find_mailbox (ctx->path);
> > -#endif
> >        break;
> >        
> >      case M_MH:
> > @@ -815,10 +804,8 @@
> >      mutt_error ( _("Could not synchronize mailbox %s!"), ctx->path);
> >  #endif
> >    
> > -#ifdef BUFFY_SIZE
> >    if (tmp && tmp->new == 0)
> >      mutt_update_mailbox (tmp);
> > -#endif
> >    return rc;
> >  }
> 
> and probably these too?

This should be ok, mutt_find_mailbox returns NULL when CHECKMBOXSIZE
is disabled.

-- 
Miroslav Lichvar