Ok, so basically you're saying that you're doing much more relaying than 
the standard one-level relaying?  Ok, that makes sense (are you sure you'd 
want the get the outermost level, though?  from my experience you'd usually 
want just the closest layer, but things may be different with the streams).

At any rate, if you do want this multilevel relaying, I think you can 
achieve it with only changing the _REL macro, and without having to change 
the others:

1.  Put __php_stream_call_depth inside the stream globals (I think you 
don't have a stream globals structure, so you can put them in the PHP core 
globals).
2.  Increment/decrement it inside each of the functions you are tracking
3.  Use TSRM macros for everything, except for the _REL macros

Zeev

At 12:25 18/03/2002, Wez Furlong wrote:
>Hi Zeev,
>
>If you look in main/php_streams.h, you'll see where I am coming from.
>Those rel_orig macros (as they stand now!) look like "thinkos" on my
>part.
>
>The concept is that the original php_stream_xxx call that triggered
>the allocation is relayed to the memory manager, as well as listing
>the place where the actual allocation took place.  Since there can
>be a number of levels of nested calls during stream_open_wrapper,
>I needed these macros rather than "plain" emalloc_rel because it
>didn't propogate the original file/line variables.
>
>If you can see a nicer way of achieving this, I'm all ears!
>
>--Wez.
>
>On 18/03/02, "Zeev Suraski" <[EMAIL PROTECTED]> wrote:
> > Are they really necessary?  A lot of work has been done to make everything
> > in PHP use the same thing, so I'd really like the avoid introducing new
> > macros at this point...
> >
> > I can tell that the basic difference is the use of 
> __php_stream_call_depth,
> > but I really can't see how you're using it :)
> >
> > #define emalloc_rel_orig(size)        \
> >               ( __php_stream_call_depth == 0 \
> >               ? _emalloc((size) ZEND_FILE_LINE_CC 
> ZEND_FILE_LINE_ORIG_RELAY_CC) \
> >               : _emalloc((size) ZEND_FILE_LINE_CC 
> ZEND_FILE_LINE_ORIG_RELAY_CC) )
> >
> > #define erealloc_rel_orig(ptr, size)  \
> >               ( __php_stream_call_depth == 0 \
> >               ? _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC
> > ZEND_FILE_LINE_ORIG_RELAY_CC) \
> >               : _erealloc((ptr), (size), 0 ZEND_FILE_LINE_CC
> > ZEND_FILE_LINE_ORIG_RELAY_CC) )
> >
> >
> > Am I missing something, or are the lines of code 100% identical whether
> > __php_stream_call_depth is 0 or not?  I can see that you are using it in
> > the REL macros, but if that's the only place you're using them, it's
> > probably better to use a special macro for that, and not replace the TSRM
> > macro completely (you can probably put __php_stream_call_depth inside your
> > stream globals, to avoid having move an extra variable around all the
> > time).  Also, I don't exactly understand the whole concept of this
> > __php_stream_call_depth and why you'd like to use __zend_orig_filename
> > instead of __zend_filename based on its value.  Can you shed some light on
> > this?
> >
> > Zeev


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to