From 903be3af71c908051df2b54c503095931da73b72 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Wed, 12 May 2004 14:56:22 +0000 Subject: [PATCH] Conditionally include various headers. Use "epaths.h", not <../src/epaths.h>. (yow): Cast result of malloc and realloc. (malloc, realloc): Declarations deleted. (main): Use time_t, not long, to avoid a compiler warning. --- lib-src/ChangeLog | 8 ++++++++ lib-src/yow.c | 23 +++++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 4f51f3a134b..4daad462065 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,11 @@ +2004-05-12 Thien-Thi Nguyen + + * yow.c: Conditionally include various headers. + Use "epaths.h", not <../src/epaths.h>. + (yow): Cast result of malloc and realloc. + (malloc, realloc): Declarations deleted. + (main): Use time_t, not long, to avoid a compiler warning. + 2004-05-10 Thien-Thi Nguyen * cvtmail.c, yow.c: Include config.h. diff --git a/lib-src/yow.c b/lib-src/yow.c index aea3b005fbe..2892d76b563 100644 --- a/lib-src/yow.c +++ b/lib-src/yow.c @@ -16,7 +16,20 @@ #include #include -#include <../src/epaths.h> /* For PATH_DATA. */ +#ifdef TIME_WITH_SYS_TIME +#include +#include +#else +#ifdef HAVE_SYS_TIME_H +#include +#else +#include +#endif +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#include "epaths.h" /* For PATH_DATA. */ #define BUFSIZE 80 #define SEP '\0' @@ -37,8 +50,6 @@ &res;}) #endif -char *malloc(), *realloc(); - void yow(); void setup_yow(); @@ -66,7 +77,7 @@ main (argc, argv) } /* initialize random seed */ - srand((int) (getpid() + time((long *) 0))); + srand((int) (getpid() + time((time_t *) 0))); setup_yow(fp); yow(fp); @@ -143,7 +154,7 @@ yow (fp) } bufsize = BUFSIZE; - buf = malloc(bufsize); + buf = (char *) malloc(bufsize); if (buf == (char *)0) { fprintf(stderr, "yow: virtual memory exhausted\n"); exit (3); @@ -156,7 +167,7 @@ yow (fp) if (i == bufsize-1) { /* Yow! Is this quotation too long yet? */ bufsize *= 2; - buf = realloc(buf, bufsize); + buf = (char *) realloc(buf, bufsize); if (buf == (char *)0) { fprintf(stderr, "yow: virtual memory exhausted\n"); exit (3); -- 2.39.2