The dprint macro is error-prone. Any FILE* can be passed to dprint, but
the macro checks that `debugfile` is not NULL (ie. it's open), not the
file pointer it received as parameter. This had also the consequence
that `debugfile` is passed to every call to `dprint`, making lines
unnecessarily long.
This commit replaces calls to `dprint` by direct calls to `mutt_debug`.
It's now hardcoded in this function that it will write in `debugfile`.
Also, remove the MUTT_LIB_WHERE magic.
The substistution has been done with the following command:
perl -0777 -pi -e 's/dprint[ ]*\((.+?),[ \t\r\n]*\(debugfile,[ ]*(.*?)\)\);/mutt_debug (\1, \2);/igs' *.c imap/*.c
And the code was then slightly ajusted to fix identation and line
length.
- dprint (1, (debugfile, "The name could not be resolved at this time. Future attempts may succeed.\n"));
+ mutt_debug (1, "The name could not be resolved at this time. Future attempts may succeed.\n");
err=SASL_TRYAGAIN;
break;
case EAI_BADFLAGS:
- dprint (1, (debugfile, "The flags had an invalid value.\n"));
+ mutt_debug (1, "The flags had an invalid value.\n");
err=SASL_BADPARAM;
break;
case EAI_FAIL:
- dprint (1, (debugfile, "A non-recoverable error occurred.\n"));
+ mutt_debug (1, "A non-recoverable error occurred.\n");
err=SASL_FAIL;
break;
case EAI_FAMILY:
- dprint (1, (debugfile, "The address family was not recognized or the address length was invalid for the specified family.\n"));
+ mutt_debug (1, "The address family was not recognized or the address length was invalid for the specified family.\n");
err=SASL_BADPROT;
break;
case EAI_MEMORY:
- dprint (1, (debugfile, "There was a memory allocation failure.\n"));
+ mutt_debug (1, "There was a memory allocation failure.\n");
err=SASL_NOMEM;
break;
case EAI_NONAME:
- dprint (1, (debugfile, "The name does not resolve for the supplied parameters. NI_NAMEREQD is set and the host's name cannot be located, or both nodename and servname were null.\n"));
+ mutt_debug (1, "The name does not resolve for the supplied parameters. NI_NAMEREQD is set and the host's name cannot be located, or both nodename and servname were null.\n");
err=SASL_FAIL; /* no real equivalent */
break;
case EAI_SYSTEM:
- dprint (1, (debugfile, "A system error occurred. The error code can be found in errno(%d,%s)).\n",errno,strerror(errno)));
+ mutt_debug (1, "A system error occurred. The error code can be found in errno(%d,%s)).\n",errno,strerror(errno));