[head tinderbox] failure on amd64/amd64

Ralf S. Engelschall rse at FreeBSD.org
Sun Aug 6 10:16:03 UTC 2006


On Sun, Aug 06, 2006, Dmitry Morozovsky wrote:

> On Sun, 6 Aug 2006, Ralf S. Engelschall wrote:
>
> RSE> > DM> It seems at least on amd64 size_t (strlen() result) is not int.
> RSE> >
> RSE> > Or, maybe, the following would be less ugly:
>
> RSE> >                 tdone_str = ctime(&tdone);
> RSE> > +               tdone_str[(strlen(tdone_str) - 1)] = '\0';
>
> Well, next thought: ctime(3) described as POSIX.1 function having fixed length
> of 26 chars. Is it safe and standards-compliant to save strlen(3) call and just
> use tdone_str[24] = '\0' ?

This was my first thought also after reading the ctime(3) manual page.
But after quickly checking the sources it didn't looked to me that
the string is always really exactly 26 characters only. I think the
strlen(3) call is acceptable as this way we are really doing what we
want: we strip the trailing newline. If we hard-code a "26" here we
would just obfuscate the source even more as the reader certainly
doesn't understand at the first spot from where the magic "26" comes
from.

                                       Ralf S. Engelschall
                                       rse at engelschall.com
                                       www.engelschall.com



More information about the freebsd-amd64 mailing list