exit(). All dead code "return 1" lines removed from *_done()s and replaced
by explicit "return 1" following done() calls in main()s (they should
never be reached). This should make cleaning up program termination
structures easier.
49 files changed:
+2007-11-04 Joel Reicher <joel@panacea.null.org>
+
+ * Changed done() link overriding to function pointer. Return type
+ is now void so that exit() can be used as done() callback. Dead
+ code return from all done()s removed, with return 1 in main()
+ following done() (should never be reached).
+
2007-08-21 Josh Bressers <josh@bress.net>
* Red Hat Bug #253342: inc.c, utils.c, utils.h: When inc is run with
2007-08-21 Josh Bressers <josh@bress.net>
* Red Hat Bug #253342: inc.c, utils.c, utils.h: When inc is run with
extern char *whatnowproc;
extern char *whomproc;
extern char *whatnowproc;
extern char *whomproc;
-extern int (*done) (int);
+extern void (*done) (int);
#include <h/prototypes.h>
#include <h/prototypes.h>
-int (*done) (int) = default_done;
-
-int
-default_done (int status)
-{
- exit (status);
- return 1; /* dead code to satisfy the compiler */
-}
+void (*done) (int) = exit;
else
annotate (draft, comp, text, inplace, datesw, delete, append);
else
annotate (draft, comp, text, inplace, datesw, delete, append);
seq_save (mp); /* synchronize message sequences */
folder_free (mp); /* free folder/message structure */
context_save (); /* save the context file */
seq_save (mp); /* synchronize message sequences */
folder_free (mp); /* free folder/message structure */
context_save (); /* save the context file */
for (addrp = 0; addrs[addrp]; addrp++)
status += process (addrs[addrp], width, normalize);
for (addrp = 0; addrs[addrp]; addrp++)
status += process (addrs[addrp], width, normalize);
+ done (status);
+ return 1;
seq_save (mp); /* synchronize message sequences */
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
seq_save (mp); /* synchronize message sequences */
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
if (nwhat)
done (0);
what_now (ed, nedit, use, drft, NULL, 0, NULLMP, NULL, 0, cwd);
if (nwhat)
done (0);
what_now (ed, nedit, use, drft, NULL, 0, NULLMP, NULL, 0, cwd);
#endif /* UCI */
maildrops ();
#endif /* UCI */
maildrops ();
done (0);
what_now (ed, nedit, NOUSE, drft, msgnam, 1, mp,
anot ? "Resent" : NULL, inplace, cwd);
done (0);
what_now (ed, nedit, NOUSE, drft, msgnam, 1, mp,
anot ? "Resent" : NULL, inplace, cwd);
status += process (dates[datep], width);
context_save (); /* save the context file */
status += process (dates[datep], width);
context_save (); /* save the context file */
+ done (status);
+ return 1;
ScanFolders();
qsort(folders, nFolders, sizeof(struct Folder), (qsort_comp) CompareFolders);
PrintFolders();
ScanFolders();
qsort(folders, nFolders, sizeof(struct Folder), (qsort_comp) CompareFolders);
PrintFolders();
ncomps = fmt_compile(nfs, &fmt);
fmt_dump(fmt);
ncomps = fmt_compile(nfs, &fmt);
fmt_dump(fmt);
print_folders();
context_save (); /* save the context file */
print_folders();
context_save (); /* save the context file */
done (0);
what_now (ed, nedit, NOUSE, drft, NULL, 0, mp,
anot ? "Forwarded" : NULL, inplace, cwd);
done (0);
what_now (ed, nedit, NOUSE, drft, NULL, 0, mp,
anot ? "Forwarded" : NULL, inplace, cwd);
*/
char *map_name(char *);
*/
char *map_name(char *);
-static int inc_done(int);
+static void inc_done(int);
#ifdef POP
static int pop_action(char *);
static int pop_pack(char *);
#ifdef POP
static int pop_action(char *);
static int pop_pack(char *);
seq_setunseen (mp, 0); /* set the Unseen-Sequence */
seq_save (mp); /* synchronize sequences */
context_save (); /* save the context file */
seq_setunseen (mp, 0); /* set the Unseen-Sequence */
seq_save (mp); /* synchronize sequences */
context_save (); /* save the context file */
inc_done (int status)
{
#ifdef POP
inc_done (int status)
{
#ifdef POP
DROPGROUPPRIVS();
}
exit (status);
DROPGROUPPRIVS();
}
exit (status);
- return 1; /* dead code to satisfy the compiler */
fprintf (out, "%s: %s\n", np->n_name, np->n_field);
}
fclose (out);
fprintf (out, "%s: %s\n", np->n_name, np->n_field);
}
fclose (out);
context_replace (pfolder, folder); /* update current folder */
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
context_replace (pfolder, folder); /* update current folder */
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
static char outfile[BUFSIZ];
static int unlink_outfile = 0;
static char outfile[BUFSIZ];
static int unlink_outfile = 0;
-static int unlink_done (int);
+static void unlink_done (int);
/* mhbuildsbr.c */
CT build_mime (char *);
/* mhbuildsbr.c */
CT build_mime (char *);
unlink_outfile = 0;
free_content (ct);
unlink_outfile = 0;
free_content (ct);
unlink_done (int status)
{
/*
unlink_done (int status)
{
/*
unlink (outfile);
exit (status);
unlink (outfile);
exit (status);
- return 1; /* dead code to satisfy the compiler */
fflush (stdout);
fflush (stderr);
fflush (stdout);
fflush (stderr);
void free_header (CT);
void free_ctinfo (CT);
void free_encoding (CT, int);
void free_header (CT);
void free_ctinfo (CT);
void free_encoding (CT, int);
+void freects_done (int);
freects_done (int status)
{
CT *ctp;
freects_done (int status)
{
CT *ctp;
free_content (*ctp);
exit (status);
free_content (*ctp);
exit (status);
- return 1; /* dead code to satisfy the compiler */
#ifdef LOCALE
setlocale(LC_ALL, "");
#endif
#ifdef LOCALE
setlocale(LC_ALL, "");
#endif
- return done (mhl (argc, argv));
+ done (mhl (argc, argv));
+ return 1;
/* mhfree.c */
void free_content (CT);
extern CT *cts;
/* mhfree.c */
void free_content (CT);
extern CT *cts;
+void freects_done (int);
context_save (); /* save the context file */
}
context_save (); /* save the context file */
}
/* mhfree.c */
void free_content (CT);
extern CT *cts;
/* mhfree.c */
void free_content (CT);
extern CT *cts;
+void freects_done (int);
context_save (); /* save the context file */
}
context_save (); /* save the context file */
}
+ done (missed);
+ return 1;
fflush (stdout);
fflush (stderr);
fflush (stdout);
fflush (stderr);
seq_save (mp); /* synchronize message sequences */
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
seq_save (mp); /* synchronize message sequences */
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
/* mhfree.c */
void free_content (CT);
extern CT *cts;
/* mhfree.c */
void free_content (CT);
extern CT *cts;
+void freects_done (int);
context_save (); /* save the context file */
}
context_save (); /* save the context file */
}
/* mhfree.c */
void free_content (CT);
extern CT *cts;
/* mhfree.c */
void free_content (CT);
extern CT *cts;
+void freects_done (int);
context_save (); /* save the context file */
}
context_save (); /* save the context file */
}
/* mhfree.c */
void free_content (CT);
extern CT *cts;
/* mhfree.c */
void free_content (CT);
extern CT *cts;
+void freects_done (int);
context_save (); /* save the context file */
}
context_save (); /* save the context file */
}
} /* host == NULL */
#endif
} /* host == NULL */
#endif
+ done (status);
+ return 1;
static int mbx_style = MBOX_FORMAT;
static int mapping = 0;
static int mbx_style = MBOX_FORMAT;
static int mapping = 0;
-static int mbxclose_done(int);
+static void mbxclose_done(int);
seq_save (mp);
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
seq_save (mp);
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
mbxclose_done (int status)
{
mbx_close (file, md);
exit (status);
mbxclose_done (int status)
{
mbx_close (file, md);
exit (status);
- return 1; /* dead code to satisfy the compiler */
-static int putzero_done (int);
+static void putzero_done (int);
int
main (int argc, char **argv)
int
main (int argc, char **argv)
seq_save (mp); /* synchronize message sequences */
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
seq_save (mp); /* synchronize message sequences */
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
putzero_done (int status)
{
if (listsw && status && !isatty (fileno (stdout)))
printf ("0\n");
exit (status);
putzero_done (int status)
{
if (listsw && status && !isatty (fileno (stdout)))
printf ("0\n");
exit (status);
- return 1; /* dead code to satisfy the compiler */
if (verbose)
printf (partno ? "Partial Message #%s Processed\n" : "Message Processed\n",
partno);
if (verbose)
printf (partno ? "Partial Message #%s Processed\n" : "Message Processed\n",
partno);
unlink (tmpfil);
context_save (); /* save the context file */
unlink (tmpfil);
context_save (); /* save the context file */
* prototypes
*/
static void rcvdistout (FILE *, char *, char *);
* prototypes
*/
static void rcvdistout (FILE *, char *, char *);
-static int unlink_done (int);
+static void unlink_done (int);
unlink_done (int status)
{
if (backup[0])
unlink_done (int status)
{
if (backup[0])
unlink (tmpfil);
exit (status ? RCV_MBX : RCV_MOK);
unlink (tmpfil);
exit (status ? RCV_MBX : RCV_MOK);
- return 1; /* dead code to satisfy the compiler */
if (mbx_close (file, md) == NOTOK)
done (RCV_MBX);
if (mbx_close (file, md) == NOTOK)
done (RCV_MBX);
+ done (RCV_MOK);
+ return 1;
*/
static char *tmpfilenam = NULL;
*/
static char *tmpfilenam = NULL;
-static int unlink_done(int);
+static void unlink_done(int);
int
main (int argc, char **argv)
int
main (int argc, char **argv)
unlink (tmpfilenam); /* remove temporary file */
tmpfilenam = NULL;
unlink (tmpfilenam); /* remove temporary file */
tmpfilenam = NULL;
}
/*
* Clean up and exit
*/
}
/*
* Clean up and exit
*/
unlink_done(int status)
{
if (tmpfilenam && *tmpfilenam)
unlink (tmpfilenam);
exit (status);
unlink_done(int status)
{
if (tmpfilenam && *tmpfilenam)
unlink (tmpfilenam);
exit (status);
- return 1; /* dead code to satisfy the compiler */
context_replace (pfolder, folder); /* update current folder */
context_save (); /* save the context file */
folder_free (mp); /* free folder structure */
context_replace (pfolder, folder); /* update current folder */
context_save (); /* save the context file */
folder_free (mp); /* free folder structure */
done (0);
what_now (ed, nedit, NOUSE, drft, msg, 0, mp,
anot ? "Replied" : NULL, inplace, cwd);
done (0);
what_now (ed, nedit, NOUSE, drft, msg, 0, mp,
anot ? "Replied" : NULL, inplace, cwd);
}
}
context_save (); /* save the context file */
}
}
context_save (); /* save the context file */
context_replace (pfolder, folder); /* update current folder */
context_save (); /* save the context file */
folder_free (mp); /* free folder structure */
context_replace (pfolder, folder); /* update current folder */
context_save (); /* save the context file */
folder_free (mp); /* free folder structure */
if (clearflag)
clear_screen ();
if (clearflag)
clear_screen ();
}
context_save (); /* save the context file */
}
context_save (); /* save the context file */
+ done (status);
+ return 1;
/*
* static prototypes
*/
/*
* static prototypes
*/
-static int armed_done (int);
+static void armed_done (int);
static void alert (char *, int);
static int tmp_fd (void);
static void anno (int, struct stat *);
static void alert (char *, int);
static int tmp_fd (void);
static void anno (int, struct stat *);
if (distfile)
unlink (distfile);
if (distfile)
unlink (distfile);
armed_done (int status)
{
longjmp (env, status ? status : NOTOK);
exit (status);
armed_done (int status)
{
longjmp (env, status ? status : NOTOK);
exit (status);
- return 1; /* dead code to satisfy the compiler */
/* deliver the message */
status = localmail (fd, mdlvr);
/* deliver the message */
status = localmail (fd, mdlvr);
- return done (status != -1 ? RCV_MOK : RCV_MBX);
+ done (status != -1 ? RCV_MOK : RCV_MBX);
+ return 1;
seq_save (mp); /* synchronize message sequences */
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
seq_save (mp); /* synchronize message sequences */
context_save (); /* save the context file */
folder_free (mp); /* free folder/message structure */
fclose (fp);
if (unlink (tmpfil) == -1)
advise (NULL, "unable to remove temp file %s", tmpfil);
fclose (fp);
if (unlink (tmpfil) == -1)
advise (NULL, "unable to remove temp file %s", tmpfil);
+ done (status);
+ return 1;