From: markus schnalke Date: Fri, 9 Dec 2011 17:34:39 +0000 (+0100) Subject: Removed void casts for ignored return values of function calls. X-Git-Tag: mmh-thesis-end~461 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=246ca516a0f7b870316116bc184347b0fb2bc00b;p=mmh Removed void casts for ignored return values of function calls. IMO, this distracts from the important without being much worth. --- diff --git a/sbr/context_read.c b/sbr/context_read.c index 4f74499..57653ea 100644 --- a/sbr/context_read.c +++ b/sbr/context_read.c @@ -97,7 +97,7 @@ context_read(void) adios(NULL, "Your `%s' profile file does not contain a valid path entry.", defpath); if (*cp != '/') - (void)snprintf(nd = buf, sizeof(buf), "%s/%s", mypath, cp); + snprintf(nd = buf, sizeof(buf), "%s/%s", mypath, cp); else nd = cp; diff --git a/sbr/folder_addmsg.c b/sbr/folder_addmsg.c index 423384a..391f5c8 100644 --- a/sbr/folder_addmsg.c +++ b/sbr/folder_addmsg.c @@ -132,10 +132,11 @@ folder_addmsg(struct msgs **mpp, char *msgfile, int selected, if (link(msgfile, newmsg) != -1) { if (deleting) { - (void)snprintf(oldmsg, sizeof (oldmsg), "%s/%s", from_dir, msgfile); - (void)ext_hook("ref-hook", oldmsg, newmsg); + snprintf(oldmsg, sizeof (oldmsg), "%s/%s", + from_dir, msgfile); + ext_hook("ref-hook", oldmsg, newmsg); } else - (void)ext_hook("add-hook", newmsg, (char *)0); + ext_hook("add-hook", newmsg, (char *)0); return msgnum; } else { @@ -188,10 +189,13 @@ folder_addmsg(struct msgs **mpp, char *msgfile, int selected, close(outfd); if (deleting) { - (void)snprintf(oldmsg, sizeof (oldmsg), "%s/%s", from_dir, msgfile); - (void)ext_hook("ref-hook", oldmsg, newmsg); + snprintf(oldmsg, sizeof oldmsg, + "%s/%s", + from_dir, + msgfile); + ext_hook("ref-hook", oldmsg, newmsg); } else - (void)ext_hook("add-hook", newmsg, (char *)0); + ext_hook("add-hook", newmsg, (char *)0); return msgnum; } diff --git a/sbr/folder_delmsgs.c b/sbr/folder_delmsgs.c index ac93068..e9257bd 100644 --- a/sbr/folder_delmsgs.c +++ b/sbr/folder_delmsgs.c @@ -92,8 +92,9 @@ folder_delmsgs(struct msgs *mp, int unlink_msgs, int nohook) */ if (!nohook) { - (void)snprintf(msgpath, sizeof (msgpath), "%s/%d", mp->foldpath, msgnum); - (void)ext_hook("del-hook", msgpath, (char *)0); + snprintf(msgpath, sizeof (msgpath), "%s/%d", + mp->foldpath, msgnum); + ext_hook("del-hook", msgpath, (char *)0); } dp = m_name(msgnum); diff --git a/sbr/folder_pack.c b/sbr/folder_pack.c index 5280e30..cd588e4 100644 --- a/sbr/folder_pack.c +++ b/sbr/folder_pack.c @@ -57,8 +57,10 @@ folder_pack(struct msgs **mpp, int verbose) ** old message file is around for the hook. */ - (void)snprintf(oldmsg, sizeof (oldmsg), "%s/%d", mp->foldpath, msgnum); - (void)snprintf(newmsg, sizeof (newmsg), "%s/%d", mp->foldpath, hole); + snprintf(oldmsg, sizeof (oldmsg), "%s/%d", + mp->foldpath, msgnum); + snprintf(newmsg, sizeof (newmsg), "%s/%d", + mp->foldpath, hole); ext_hook("ref-hook", oldmsg, newmsg); /* move the message file */ diff --git a/sbr/getpass.c b/sbr/getpass.c index 14f2242..3fd4528 100644 --- a/sbr/getpass.c +++ b/sbr/getpass.c @@ -66,12 +66,12 @@ nmh_getpass(const char *prompt) fout = stderr; fin = stdin; } else { /* Reading directly from terminal here */ - (void)tcgetattr(fileno(fin), &oterm); + tcgetattr(fileno(fin), &oterm); term = oterm; /* Save original info */ term.c_lflag &= ~ECHO; - (void)fputs(prompt, fout); + fputs(prompt, fout); rewind(fout); /* implied flush */ - (void)tcsetattr(fileno(fin), TCSANOW, &term); + tcsetattr(fileno(fin), TCSANOW, &term); } for (p = buf; (ch = getc(fin)) != EOF && ch != '\n' && @@ -80,10 +80,10 @@ nmh_getpass(const char *prompt) *p = '\0'; if (istty) { - (void)tcsetattr(fileno(fin), TCSANOW, &oterm); + tcsetattr(fileno(fin), TCSANOW, &oterm); rewind(fout); - (void)fputc('\n', fout); - (void)fclose(fin); + fputc('\n', fout); + fclose(fin); } return buf; } diff --git a/uip/annosbr.c b/uip/annosbr.c index e48f7d9..034aa12 100644 --- a/uip/annosbr.c +++ b/uip/annosbr.c @@ -113,7 +113,7 @@ annolist(char *file, char *comp, char *text, int number) for (n = 0, cp = field; (c = getc(fp)) != EOF; *cp++ = c) { if (c == '\n' && (c = getc(fp)) != ' ' && c != '\t') { - (void)ungetc(c, fp); + ungetc(c, fp); c = '\n'; break; } @@ -133,19 +133,19 @@ annolist(char *file, char *comp, char *text, int number) ; if (number) - (void)printf("%d\t", ++count); + printf("%d\t", ++count); if (text == (char *)0 && (sp = strrchr(cp, '/')) != (char *)0) cp = sp + 1; - (void)printf("%s\n", cp); + printf("%s\n", cp); } } while (*field != '\0' && *field != '-'); /* Clean up. */ free(field); - (void)fclose(fp); + fclose(fp); return; } @@ -247,7 +247,7 @@ annosbr(int fd, char *file, char *comp, char *text, int inplace, for (n = 0, cp = field; (c = getc(fp)) != EOF; *cp++ = c) { if (c == '\n' && (c = getc(fp)) != ' ' && c != '\t') { - (void)ungetc(c, fp); + ungetc(c, fp); c = '\n'; break; } @@ -357,13 +357,13 @@ annosbr(int fd, char *file, char *comp, char *text, int inplace, rewind(fp); else { - (void)putc(c, tmp); + putc(c, tmp); while ((c = getc(fp)) != EOF) { - (void)putc(c, tmp); + putc(c, tmp); if (c == '\n') { - (void)ungetc(c = getc(fp), fp); + ungetc(c = getc(fp), fp); if (c == '\n' || c == '-') break; @@ -451,7 +451,7 @@ annosbr(int fd, char *file, char *comp, char *text, int inplace, */ if (delete >= -1) - (void)fclose(fp); + fclose(fp); return 0; } diff --git a/uip/burst.c b/uip/burst.c index ec50708..fc2f711 100644 --- a/uip/burst.c +++ b/uip/burst.c @@ -363,13 +363,13 @@ burst(struct msgs **mpp, int msgnum, struct smsg *smsgs, int numburst, if (rename(f1, f3) == NOTOK) admonish(f3, "unable to rename %s to", f1); - (void)snprintf(f3, sizeof (f3), "%s/%d", maildir, i); + snprintf(f3, sizeof (f3), "%s/%d", maildir, i); ext_hook("del-hook", f3, (char *)0); } if (rename(f2, f1) == NOTOK) admonish(f1, "unable to rename %s to", f2); - (void)snprintf(f3, sizeof (f3), "%s/%d", maildir, i); + snprintf(f3, sizeof (f3), "%s/%d", maildir, i); ext_hook("add-hook", f3, (char *)0); copy_msg_flags(mp, i, msgnum); diff --git a/uip/inc.c b/uip/inc.c index 54eb70e..1834c92 100644 --- a/uip/inc.c +++ b/uip/inc.c @@ -463,7 +463,7 @@ main(int argc, char **argv) if (incerr < 0) { /* error */ if (locked) { GETGROUPPRIVS(); /* Be sure we can unlock mail file */ - (void) lkfclose(in, newmail); in = NULL; + lkfclose(in, newmail); in = NULL; DROPGROUPPRIVS(); /* ** And then return us to normal ** privileges @@ -521,7 +521,7 @@ main(int argc, char **argv) */ if (locked) { GETGROUPPRIVS(); /* Be sure we can unlock mail file */ - (void) lkfclose(in, newmail); in = NULL; + lkfclose(in, newmail); in = NULL; DROPGROUPPRIVS(); /* And then return us to normal privileges */ } else { fclose(in); in = NULL; diff --git a/uip/install-mh.c b/uip/install-mh.c index 30ac8f6..615ac71 100644 --- a/uip/install-mh.c +++ b/uip/install-mh.c @@ -126,8 +126,7 @@ main(int argc, char **argv) } if (!autof && gans("Do you want help? ", anoyes)) { - (void)printf( - "\n" + printf("\n" "Prior to using nmh, it is necessary to have a file in your login\n" "directory (%s) named %s which contains information\n" "to direct certain nmh operations. The only item which is required\n" diff --git a/uip/rmf.c b/uip/rmf.c index 3808f54..10a4a10 100644 --- a/uip/rmf.c +++ b/uip/rmf.c @@ -158,7 +158,7 @@ rmf(char *folder) ** Run the external delete hook program. */ - (void)ext_hook("del-hook", maildir, (char *)0); + ext_hook("del-hook", maildir, (char *)0); j = strlen(backup_prefix); while ((dp = readdir(dd))) { diff --git a/uip/sendsbr.c b/uip/sendsbr.c index a8e0964..8d85559 100644 --- a/uip/sendsbr.c +++ b/uip/sendsbr.c @@ -175,12 +175,12 @@ sendsbr(char **vec, int vecp, char *drft, struct stat *st, else p++; - (void)strcpy(body_file_name, p); + strcpy(body_file_name, p); *p++ = ','; - (void)strcpy(p, body_file_name); - (void)strcat(p, ".orig"); + strcpy(p, body_file_name); + strcat(p, ".orig"); - (void)unlink(composition_file_name); + unlink(composition_file_name); } } @@ -257,10 +257,10 @@ attach(char *attachment_header_field_name, char *draft_file_name, ** Make names for the temporary files. */ - (void)strncpy(body_file_name, + strncpy(body_file_name, m_mktemp(toabsdir(invo_name), NULL, NULL), sizeof (body_file_name)); - (void)strncpy(composition_file_name, + strncpy(composition_file_name, m_mktemp(toabsdir(invo_name), NULL, NULL), sizeof (composition_file_name)); @@ -286,9 +286,9 @@ attach(char *attachment_header_field_name, char *draft_file_name, while (get_line() != EOF && *field != '\0' && *field != '-') if (strncasecmp(field, attachment_header_field_name, length) != 0 || field[length] != ':') - (void)fprintf(composition_file, "%s\n", field); + fprintf(composition_file, "%s\n", field); - (void)fputs("--------\n", composition_file); + fputs("--------\n", composition_file); /* ** Copy the message body to a temporary file. @@ -298,7 +298,7 @@ attach(char *attachment_header_field_name, char *draft_file_name, while ((c = getc(draft_file)) != EOF) putc(c, body_file); - (void)fclose(body_file); + fclose(body_file); } /* @@ -328,14 +328,14 @@ attach(char *attachment_header_field_name, char *draft_file_name, } } - (void)fclose(composition_file); + fclose(composition_file); /* ** We're ready to roll! Run mhbuild on the composition file. ** Note that mhbuild is in the context as buildmimeproc. */ - (void)sprintf(buf, "%s %s", buildmimeproc, composition_file_name); + sprintf(buf, "%s %s", buildmimeproc, composition_file_name); if (system(buf) != 0) { clean_up_temporary_files(); @@ -348,8 +348,8 @@ attach(char *attachment_header_field_name, char *draft_file_name, static void clean_up_temporary_files(void) { - (void)unlink(body_file_name); - (void)unlink(composition_file_name); + unlink(body_file_name); + unlink(composition_file_name); return; } @@ -370,7 +370,7 @@ get_line(void) for (n = 0, p = field; (c = getc(draft_file)) != EOF; *p++ = c) { if (c == '\n' && (c = getc(draft_file)) != ' ' && c != '\t') { - (void)ungetc(c, draft_file); + ungetc(c, draft_file); c = '\n'; break; } @@ -445,7 +445,7 @@ make_mime_composition_file_entry(char *file_name, int attachformat) } } - (void)fclose(fp); + fclose(fp); content_type = binary ? "application/octet-stream" : "text/plain"; @@ -467,7 +467,7 @@ make_mime_composition_file_entry(char *file_name, int attachformat) switch (attachformat) { case 0: /* Insert name, file mode, and Content-Id. */ - (void)fprintf(composition_file, + fprintf(composition_file, "#%s; name=\"%s\"; x-unix-mode=0%.3ho", content_type, ((p = strrchr(file_name, '/')) == (char *)0) ? file_name : p + 1, @@ -479,7 +479,7 @@ make_mime_composition_file_entry(char *file_name, int attachformat) file_name); } - (void)sprintf(cmd, "file '%s'", file_name); + sprintf(cmd, "file '%s'", file_name); if ((fp = popen(cmd, "r")) != (FILE *)0 && fgets(cmd, sizeof (cmd), fp) != (char *)0) { @@ -505,9 +505,9 @@ make_mime_composition_file_entry(char *file_name, int attachformat) if (*p != '\0') /* Insert Content-Description. */ - (void)fprintf(composition_file, " [ %s ]", p); + fprintf(composition_file, " [ %s ]", p); - (void)pclose(fp); + pclose(fp); } break; @@ -563,7 +563,7 @@ make_mime_composition_file_entry(char *file_name, int attachformat) ** Finish up with the file name. */ - (void)fprintf(composition_file, " %s\n", file_name); + fprintf(composition_file, " %s\n", file_name); return; } diff --git a/uip/sortm.c b/uip/sortm.c index 0caab30..0d8e39d 100644 --- a/uip/sortm.c +++ b/uip/sortm.c @@ -562,8 +562,8 @@ rename_msgs(struct msgs *mp, struct smsg **mlist) ** messages in the folder. */ - (void)snprintf(f1, sizeof (f1), "%s/%d", mp->foldpath, old); - (void)snprintf(newbuf, sizeof (newbuf), "%s/%d", + snprintf(f1, sizeof (f1), "%s/%d", mp->foldpath, old); + snprintf(newbuf, sizeof (newbuf), "%s/%d", mp->foldpath, mp->hghmsg + 1); ext_hook("ref-hook", f1, newbuf); @@ -579,7 +579,7 @@ rename_msgs(struct msgs *mp, struct smsg **mlist) ** to the real place. */ - (void)snprintf(f1, sizeof (f1), "%s/%d", mp->foldpath, new); + snprintf(f1, sizeof (f1), "%s/%d", mp->foldpath, new); ext_hook("ref-hook", newbuf, f1); if (rename(tmpfil, m_name(new)) == NOTOK) diff --git a/uip/whatnowsbr.c b/uip/whatnowsbr.c index 8687815..032566e 100644 --- a/uip/whatnowsbr.c +++ b/uip/whatnowsbr.c @@ -301,7 +301,7 @@ WhatNow(int argc, char **argv) */ if (*(argp+1) == (char *)0) { - (void)sprintf(buf, "$SHELL -c \"cd;pwd\""); + sprintf(buf, "$SHELL -c \"cd;pwd\""); } else { writesomecmd(buf, BUFSIZ, "cd", "pwd", argp); } @@ -333,7 +333,7 @@ WhatNow(int argc, char **argv) ** accustomed to. */ writelscmd(buf, sizeof(buf), argp); - (void)system_in_dir(cwd, buf); + system_in_dir(cwd, buf); break; case ALISTCMDSW: @@ -483,7 +483,7 @@ WhatNow(int argc, char **argv) if (atoi(*argp) == 1) *argp = ""; else - (void)sprintf(*argp, "%d", atoi(*argp) - 1); + sprintf(*argp, "%d", atoi(*argp) - 1); } } }