~kevin8t8/mutt

46223bc9fe1acc40530f64775a8d5aceb5122353 — Kevin McCarthy 7 months ago fb2487c
Convert start_debug() to use buffer pool.
1 files changed, 11 insertions(+), 6 deletions(-)

M init.c
M init.c => init.c +11 -6
@@ 3331,22 3331,27 @@ int mutt_getvaluebyname (const char *name, const struct mapping_t *map)
static void start_debug (void)
{
  int i;
  char buf[_POSIX_PATH_MAX];
  char buf2[_POSIX_PATH_MAX];
  BUFFER *buf, *buf2;

  buf = mutt_buffer_pool_get ();
  buf2 = mutt_buffer_pool_get ();

  /* rotate the old debug logs */
  for (i=3; i>=0; i--)
  {
    snprintf (buf, sizeof(buf), "%s/.muttdebug%d", NONULL(Homedir), i);
    snprintf (buf2, sizeof(buf2), "%s/.muttdebug%d", NONULL(Homedir), i+1);
    rename (buf, buf2);
    mutt_buffer_printf (buf, "%s/.muttdebug%d", NONULL(Homedir), i);
    mutt_buffer_printf (buf2, "%s/.muttdebug%d", NONULL(Homedir), i+1);
    rename (mutt_b2s (buf), mutt_b2s (buf2));
  }
  if ((debugfile = safe_fopen(buf, "w")) != NULL)
  if ((debugfile = safe_fopen(mutt_b2s (buf), "w")) != NULL)
  {
    setbuf (debugfile, NULL); /* don't buffer the debugging output! */
    dprint(1,(debugfile,"Mutt/%s (%s) debugging at level %d\n",
	      MUTT_VERSION, ReleaseDate, debuglevel));
  }

  mutt_buffer_pool_release (&buf);
  mutt_buffer_pool_release (&buf2);
}
#endif