I think that the use of switch for the two-way branches could have
been a performance optimization. I think it's clearer to use if,
especially in the fall-through case.
As setjmp() is known to return with either 0 or something else, we
should compare against 0 and not against some define (for which I
again and again wonder if it stands for 0 or for 1).
FILE *fp = NULL;
struct mcomp *c1;
FILE *fp = NULL;
struct mcomp *c1;
- switch (setjmp(env)) {
- case OK:
+ if (setjmp(env) == 0) {
if (fname) {
fp = mhl_action ? (*mhl_action) (fname) :
fopen(fname, "r");
if (fname) {
fp = mhl_action ? (*mhl_action) (fname) :
fopen(fname, "r");
}
SIGNAL(SIGINT, intrser);
mhlfile(fp, fname, ofilen, ofilec);
}
SIGNAL(SIGINT, intrser);
mhlfile(fp, fname, ofilen, ofilec);
- /* FALL THROUGH! */
- default:
- SIGNAL(SIGINT, SIG_IGN);
- if (mhl_action == NULL && fp != stdin)
- fclose(fp);
- if (holder.c_text) {
- free(holder.c_text);
- holder.c_text = NULL;
- }
- free_queue(&msghd, &msgtl);
- for (c1 = fmthd; c1; c1 = c1->c_next)
- c1->c_flags &= ~HDROUTPUT;
- break;
+
+ SIGNAL(SIGINT, SIG_IGN);
+ if (mhl_action == NULL && fp != stdin)
+ fclose(fp);
+ if (holder.c_text) {
+ free(holder.c_text);
+ holder.c_text = NULL;
+ }
+ free_queue(&msghd, &msgtl);
+ for (c1 = fmthd; c1; c1 = c1->c_next)
+ c1->c_flags &= ~HDROUTPUT;
*cp = '\0';
switch (setjmp(sigenv)) {
*cp = '\0';
switch (setjmp(sigenv)) {
- switch (setjmp(env)) {
- case OK:
+ if (setjmp(env) == 0) {
status = sendaux(vec, vecp, drft, st) ? NOTOK : OK;
if (status == OK) {
/* move original draft to +trash folder */
status = sendaux(vec, vecp, drft, st) ? NOTOK : OK;
if (status == OK) {
/* move original draft to +trash folder */
dup2(dupfd, 0);
close(dupfd);
}
dup2(dupfd, 0);
close(dupfd);
}