Skip to content
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

[ci skip] Clarify intention in phpdbg, removing one TODO comment #16014

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

nielsdos
Copy link
Member

The point of WATCH_ON_BUCKET is to watch for all 3 fields of the bucket, so the fallthrough is intended.

The point of WATCH_ON_BUCKET is to watch for all 3 fields of the bucket,
so the fallthrough is intended.
Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

As the person that added the TODO when I introduced ZEND_FALLTHROUGH to enable the compiler warning, I appreciate knowing why the fall through is needed. :)

Copy link
Member

@bwoebi bwoebi left a comment

Choose a reason for hiding this comment

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

That's right :-)

@@ -138,10 +138,10 @@ const phpdbg_command_t phpdbg_watch_commands[] = {
bool phpdbg_check_watch_diff(phpdbg_watchtype type, void *oldPtr, void *newPtr) {
switch (type) {
case WATCH_ON_BUCKET:
if (memcmp(&((Bucket *) oldPtr)->h, &((Bucket *) newPtr)->h, sizeof(Bucket) - sizeof(zval) /* key/val comparison */) != 0) {
if (memcmp(&((Bucket *) oldPtr)->h, &((Bucket *) newPtr)->h, sizeof(Bucket) - sizeof(zval) /* hash+key comparison */) != 0) {
return 2;
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated thing I just noticed, but the function says it returns bool but here it returns 2.

I am going to blame myself for not catching this when I probably changed the return type, but is the value of 2 important here?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah indeed it seems irrelevant, maybe it was intended at one point to be used to signal the bucket key has changed, but who knows.

@nielsdos nielsdos merged commit d5f6e56 into php:master Sep 24, 2024
2 checks passed
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.

4 participants