Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -4927,13 +4927,15 @@ static uint32_t find_frameless_function_offset(uint32_t arity, const void *handl
{
void **handlers = zend_flf_handlers;
void **current = handlers;
while (current) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So why not change this to *current ? Seems nicer than rewriting the code (which would avoid an induction loop variable)

while (*current) {
if (*current == handler) {
return current - handlers;
}
current++;
}

/* Unreachable in practice: zend_register_functions() records the handler

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This comment is good

* of every frameless_function_infos entry at registration time. */
return (uint32_t)-1;
}

Expand Down Expand Up @@ -4963,10 +4965,9 @@ static const zend_frameless_function_info *find_frameless_function_info(const ze
|| frameless_function_info->num_args == args->children)) {
uint32_t num_args = frameless_function_info->num_args;
uint32_t offset = find_frameless_function_offset(num_args, frameless_function_info->handler);
if (offset == (uint32_t)-1) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this cleanup or necessary?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

kind of is yes, frameless_function_info increment sits at the bottom of the while part, previously continue skipped it, before vs now: -1 as return could not happen, with *current it now can.

continue;
if (offset != (uint32_t)-1) {
return frameless_function_info;
}
return frameless_function_info;
}
frameless_function_info++;
}
Expand Down
Loading