From: Pierre Habouzit Date: Sat, 18 Nov 2006 21:09:47 +0000 (+0100) Subject: simplifications. X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=8b5621629de0dda169433c04f5ad685f31382dc7;p=apps%2Fmadmutt.git simplifications. fix a bug in mutt_gen_msgid Signed-off-by: Pierre Habouzit --- diff --git a/sendlib.c b/sendlib.c index cc2562d..0324295 100644 --- a/sendlib.c +++ b/sendlib.c @@ -7,8 +7,6 @@ * please see the file GPL in the top level source directory. */ -#define _SENDLIB_C 1 - #include #include @@ -44,17 +42,6 @@ #define EX_OK 0 #endif -/* If you are debugging this file, comment out the following line. */ -/*#define NDEBUG*/ - -#ifdef NDEBUG -#define assert(x) -#else -#include -#endif - -#define DISPOSITION(X) X==DISPATTACH?"attachment":"inline" - static void transform_to_7bit (BODY * a, FILE * fpin); static void encode_quoted (fgetconv_t * fc, FILE * fout, int istext) @@ -314,6 +301,7 @@ int mutt_write_mime_header (BODY * a, FILE * f) if (a->description) fprintf (f, "Content-Description: %s\n", a->description); +#define DISPOSITION(X) X==DISPATTACH?"attachment":"inline" fprintf (f, "Content-Disposition: %s", DISPOSITION (a->disposition)); if (a->use_disp) { @@ -588,10 +576,7 @@ static ssize_t convert_file_to (FILE * file, const char *fromcode, ib = bufi; ob = bufu, obl = sizeof (bufu); n = my_iconv(cd1, ibl ? &ib : 0, &ibl, &ob, &obl); - assert (n == -1 || !n); if (n == -1 && ((errno != EINVAL && errno != E2BIG) || ib == bufi)) { - assert (errno == EILSEQ || - (errno == EINVAL && ib == bufi && ibl < ssizeof (bufi))); ret = -1; break; } @@ -1685,18 +1670,14 @@ static char *mutt_gen_msgid (void) { char buf[SHORT_STRING]; char localpart[SHORT_STRING]; - unsigned int localpart_length; const char *fqdn; - if (!(fqdn = mutt_fqdn (0))) - fqdn = NONULL (Hostname); - - localpart_length = sizeof (buf) - m_strlen(fqdn) - 4; /* the 4 characters are '<', '@', '>' and '\0' */ - - mutt_gen_localpart (localpart, localpart_length, MsgIdFormat); + if (!(fqdn = mutt_fqdn(0))) + fqdn = NONULL(Hostname); - snprintf (buf, sizeof (buf), "<%s@%s>", localpart, fqdn); - return (m_strdup(buf)); + mutt_gen_localpart(localpart, sizeof(localpart), MsgIdFormat); + snprintf(buf, sizeof(buf), "<%s@%s>", localpart, fqdn); + return m_strdup(buf); } static RETSIGTYPE alarm_handler (int sig)