RE: ZSTR and NULL problems again
| From: | Frank M. Kromann | Date: | Tue, 25 Apr 2006 15:45:29 +0000 |
| Subject: | RE: ZSTR and NULL problems again | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-22962@lists.php.net to get a copy of this message | ||
NULL_ZSTR is not a problem, but when a macro defines ZSTR(buf) and buf is
NULL_ZSTR you get ZSTR(NULL_ZSTR) which is invalid.
- Frank
> What was the problem with NULL_ZSTR?
>
> Dmitry.
>
> > -----Original Message-----
> > From: Andrei Zmievski [mailto:andrei@gravitonic.com]
> > Sent: Tuesday, April 25, 2006 1:35 AM
> > To: PHP Internals
> > Cc: Dmitry Stogov; Frank M. Kromann
> > Subject: ZSTR and NULL problems again
> >
> >
> > After Frank's latest changes, HEAD doesn't compile under gcc 2.95
> > anymore:
> >
> > /homes/andrei/dev/php-src/ext/spl/spl_directory.c:1359: cast to union
> > type from type not present in union
> >
> > That line is:
> >
> > buf = php_stream_get_line(intern->u.file.stream, NULL, 0,
> > &line_len);
> >
> > Definition of php_stream_get_line():
> >
> > #define php_stream_get_line(stream, buf, maxlen, retlen)
> > _php_stream_get_line((stream), IS_STRING, ZSTR(buf), (maxlen), 0,
> > (retlen) TSRMLS_CC)
> >
> > And under GCC ZSTR is defined as:
> >
> > typedef union _zstr {
> > char *s;
> > UChar *u;
> > void *v;
> > } zstr;
> >
> > #ifdef __GNUC__
> > # define ZSTR(x) ((zstr)(x))
> > # define NULL_ZSTR ZSTR((void*)NULL)
> > # define EMPTY_ZSTR ZSTR("\0\0")
> >
> > So, do we have to pass (void*)NULL everywhere now? Or can we
> > do this in
> > a cross-platform way somehow?
> >
> > -Andrei
> >
> >
> >
>
>
>