Vincent Lefevre <[EMAIL PROTECTED]>:
> > - time_t t;
> > + time_t t = 0; /* to avoid compiler warning */
> >
> > - /*
> > - * gcc thinks it has to warn about uninitialized use
> > - * of t. This is wrong.
> > - */
> > -
>
> I disagree. You shouldn't prevent warnings like this. If gcc thinks
> that the variable is uninitialized, it should be fixed, and you
> shouldn't add unnecessary code, that makes it bigger...
You're right. My patch made the code bigger. By exactly one xor
instruction on i386! But here's an alternative patch that makes the
code smaller (but it is less obvious that this patch is safe):
--- imap.c.orig Wed Mar 8 10:01:44 2000
+++ imap.c Thu Mar 30 14:15:02 2000
@@ -1154,13 +1154,8 @@
{
char buf[LONG_STRING];
static time_t checktime=0;
- time_t t;
+ time_t t = 0;
- /*
- * gcc thinks it has to warn about uninitialized use
- * of t. This is wrong.
- */
-
if (ImapCheckTimeout)
{
t = time(NULL);
@@ -1170,7 +1165,7 @@
if ((ImapCheckTimeout && t >= ImapCheckTimeout)
|| ((CTX_DATA->reopen & IMAP_REOPEN_ALLOW) && (CTX_DATA->reopen &
~IMAP_REOPEN_ALLOW)))
{
- if (ImapCheckTimeout) checktime += t;
+ checktime += t;
CTX_DATA->check_status = 0;
if (imap_exec (buf, sizeof (buf), CTX_DATA, "NOOP", 0) != 0)