[PATCH] Fix compilation warnings in test/smtp-dummy.c.

Carl Worth cworth at cworth.org
Tue Jun 21 14:59:04 PDT 2011


On Thu, 16 Jun 2011 14:32:08 +0400, Dmitry Kurochkin <dmitry.kurochkin at gmail.com> wrote:
> * Remove unused variables in main(): buf, bytes and greeting.
> * Replace return with no value in main() with exit(3).

Thanks. I'd notice these occasionally when running the test suite and
had meant for some time to fix them. But when doing my typical
compilation within emacs, (with just "make"), I wouldn't get these
warnings so I wasn't cleaning these in my typical work to make the
compilation error/warning-free.

I did follow up with a commit to prefer return (with a value) over
exit(), which I applied throughout the main() function:

commit b1aa676cca01ce0d907d220dc3c3a5142991c1cf
Author: Carl Worth <cworth at cworth.org>
Date:   Tue Jun 21 14:54:10 2011 -0700

    smtp-dummy: Prefer return rather than exit() in main.
    
    The main() function should be written as just another function with a
    return value. This allows for more reliable code reuse. Imagine that
    main() grows too large and needs to be factored into multiple
    functions. At that point, exit() is probably the wrong thing, yet can
    also be hard to notice as it's in less-frequently-tested exceptional
    cases.


-Carl

-- 
carl.d.worth at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20110621/c7fb749b/attachment.pgp>


More information about the notmuch mailing list