Skip to content

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 :-)

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