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

Updated code for API 72.1 #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lucaspwo
Copy link

@lucaspwo lucaspwo commented Aug 28, 2024

Modified the input_callback function to conform with API 72.1.

Summary by Sourcery

Update the input_callback function to conform with API 72.1 by changing the parameter type for the event queue to a context pointer.

Enhancements:

  • Modify the input_callback function to use a context pointer for the event queue, aligning with API 72.1 requirements.

Copy link

sourcery-ai bot commented Aug 28, 2024

Reviewer's Guide by Sourcery

This pull request updates the input_callback function in the flipper_hero.c file to conform with API 72.1. The main change involves modifying the function signature and how it handles the event queue.

File-Level Changes

Change Details Files
Modified the input_callback function signature and parameter handling
  • Changed the second parameter from FuriMessageQueue* to void*
  • Removed the furi_assert check for event_queue
  • Added a new line to cast the void* ctx to FuriMessageQueue*
flipper_hero.c

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @lucaspwo - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a brief comment explaining the reason for this API change and its implications.
  • The furi_assert for event_queue was removed. Consider adding it back after extracting event_queue from ctx to maintain parameter validation.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

Comment on lines +49 to +51
static void input_callback(InputEvent* input_event, void* ctx) {

FuriMessageQueue* event_queue = ctx;
Copy link

Choose a reason for hiding this comment

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

suggestion: Consider adding type safety checks for the ctx parameter

The change from FuriMessageQueue* to void* removes type safety at the function interface. Consider adding a static_assert or similar compile-time check to ensure ctx is of the correct type. Also, the removal of furi_assert(event_queue) eliminates an explicit null check. Consider re-adding this or a similar check to fail early if preconditions aren't met.

Suggested change
static void input_callback(InputEvent* input_event, void* ctx) {
FuriMessageQueue* event_queue = ctx;
static void input_callback(InputEvent* input_event, void* ctx) {
FuriMessageQueue* event_queue = ctx;
furi_assert(event_queue);
_Static_assert(sizeof(FuriMessageQueue*) == sizeof(void*), "Incompatible pointer sizes");

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

Successfully merging this pull request may close these issues.

1 participant