Skip to content

Use APPLY_STOP in pcre_clean_cache() #15839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

iluuu1994
Copy link
Member

@iluuu1994 iluuu1994 commented Sep 11, 2024

Once num_clean has reached 0, we never remove any more elements anyway.

Found while looking at #15205.

  • Edit: Ah, actually we shouldn't stop when only !pce->refcount is true. I'll fix that in a sec.

Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems right

Once num_clean has reached 0, we never remove any more elements anyway.

Closes phpGH-15839
@iluuu1994 iluuu1994 force-pushed the pcre-clean-use-ht-stop branch from 6cb31fe to c6f117c Compare September 11, 2024 21:50
@iluuu1994
Copy link
Member Author

iluuu1994 commented Sep 11, 2024

I realized the callback of zend_hash_apply_with_argument() accepts flags, so we can actually remove and stop at the same time. It also gets rid of the duplicate condition. Doesn't really make a difference though. 😄

Copy link
Member

@nielsdos nielsdos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL, indeed

@iluuu1994 iluuu1994 merged commit ffb4405 into php:master Sep 12, 2024
10 checks passed
Girgias pushed a commit to Girgias/php-src that referenced this pull request Sep 12, 2024
Once num_clean has reached 0, we never remove any more elements anyway.

Closes phpGH-15839
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants