[php-src] PR #18740: Update filter.c
| From: | itashia | Date: | Mon, 02 Jun 2025 11:53:25 +0000 |
| Subject: | [php-src] PR #18740: Update filter.c | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-31929@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/18740
Author: itashia
Refactor: Optimize performance, memory handling, and error management
- Added optimization macros (e.g.,
UNEXPECTED) for rare branches
- Used do_alloca / free_alloca for efficient temporary memory allocation
- Replaced verbose conditionals with ternary operators where appropriate
- Removed redundant condition checks
- Improved variable grouping and naming for readability
- Added clearer comments to explain logic
- Used memmove instead of memcpy for overlapping memory regions
- Calculated memory sizes more precisely
- Introduced helper function php_stream_bucket_brigade_cleanup for repeated cleanup
logic
- Enhanced error handling with additional checks and better resource cleanup
- Reduced redundant computations in loops
- Improved memory access patterns for better loop performance