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

Re: [PATCH] runtime configurable buffy size



On Thursday, 01 March 2007 at 16:23, Miroslav Lichvar wrote:
> On Wed, Feb 28, 2007 at 02:33:17PM +0100, Christoph Berg wrote:
> > Re: Miroslav Lichvar 2007-02-28 <20070228130731.GA23284@localhost>
> > > attached is a patch that makes the buffy size option configurable at
> > > runtime. Mutt binary compiled with --enable-buffy-size will
> > > have an extra boolean variable that controls if mbox size should be
> > > used when checking for new mail.
> > 
> > > +++ init.h        28 Feb 2007 12:38:11 -0000
> > > +#ifdef BUFFY_SIZE
> > > +  { "buffy_size",        DT_BOOL, R_NONE, OPTBUFFYSIZE, 1 },
> > 
> > I'd remove the ./configure option and let it default to 0.
> > 
> > This would also be the chance to give the option a less silly name,
> > e.g. check_mbox_size.
> 
> Ok, here is a patch that removes buffy_size completely and adds the
> check_box_size option.

Looks nice, thanks. But...

> 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).

> Index: mx.c
> @@ -426,9 +422,7 @@
>    }
>    else if ((f = fopen (path, "r")) != NULL)
>    {
> -#ifndef BUFFY_SIZE
>      struct utimbuf times;
> -#endif
>  
>      fgets (tmp, sizeof (tmp), f);
>      if (mutt_strncmp ("From ", tmp, 5) == 0)
> @@ -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
>    {
> @@ -773,9 +766,7 @@
>  /* save changes to disk */
>  static int sync_mailbox (CONTEXT *ctx, int *index_hint)
>  {
> -#ifdef BUFFY_SIZE
>    BUFFY *tmp = NULL;
> -#endif
>    int rc = -1;
>  
>    if (!ctx->quiet)
> @@ -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?