# Repetitive calling of Z_STRLEN_P(value) in ext/filter/logical_filter.c

- Thread: https://externals.io/message/47824
- Original archive: https://news-web.php.net/php.internals/47824
- Started by Justin Dearing on 2010-04-07T16:07:33+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #47824 — Justin Dearing — 2010-04-07T16:07:33+00:00

URL: https://externals.io/message/47824#47824

Hey,

Sorry for pestering with excessive questions, but I've not done a lot of C
programming.

In filter.c, specificalyl in php_filter_validate_ip(), Z_STRLEN_P(value)
gets called a lot. I know compilers tend to inline short functions, but are
they smart enough to assign a variable to a repetive macro expansion?

Justin

---

## #47825 — Michael Maclean — 2010-04-07T16:10:51+00:00

URL: https://externals.io/message/47824#47825 · In reply to: #47824

Justin Dearing wrote:
> Hey,
> 
> Sorry for pestering with excessive questions, but I've not done a lot of C
> programming.
> 
> In filter.c, specificalyl in php_filter_validate_ip(), Z_STRLEN_P(value)
> gets called a lot. I know compilers tend to inline short functions, but are
> they smart enough to assign a variable to a repetive macro expansion?

Z_STRLEN_P is just a macro that expands to a variant of Z_STRLEN, which
in turn is just (zval).value.str.len. These macros will be expanded by
the preprocessor before the code is actually compiled.

http://php-og.mgdm.net/opengrok/xref/PHP_5_3/Zend/zend_operators.h#Z_STRLEN_P


Michael
