Hello all,
I would like to suggest these changes to remove unused variables
and a respectively unnecessary call of the gettimeofday, also removes
a casting in the malloc, that seems to be unnecessary.
Index: worm.c
===================================================================
RCS file: /cvs/src/games/worm/worm.c,v
retrieving revision 1.28
diff -u -p -r1.28 worm.c
--- worm.c 9 Mar 2015 19:52:02 -0000 1.28
+++ worm.c 11 Aug 2015 18:39:55 -0000
@@ -88,8 +88,7 @@ int
main(int argc, char **argv)
{
int retval;
- struct timeval t, tod;
- struct timezone tz;
+ struct timeval t;
struct pollfd pfd[1];
const char *errstr;
@@ -162,7 +161,6 @@ main(int argc, char **argv)
/* Delay could be a command line option */
t.tv_sec = 1;
t.tv_usec = 0;
- (void)gettimeofday(&tod, &tz);
pfd[0].fd = STDIN_FILENO;
pfd[0].events = POLLIN;
retval = poll(pfd, 1, t.tv_sec * 1000 + t.tv_usec / 1000);
@@ -335,7 +333,7 @@ newlink(void)
{
struct body *tmp;
- if ((tmp = (struct body *) malloc(sizeof (struct body))) == NULL) {
+ if ((tmp = malloc(sizeof (struct body))) == NULL) {
endwin();
errx(1, "out of memory");
}
*att.*
* Vinicios Barros,*
*Undergrad Computer Engineering at PUCRS*
*IRC freenode/OFTC vbarros*
*twitter: @viniciosbarros*
*----------------------------------------------------------------------------*