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