Skip to content

Conversation

@ndrs-pst
Copy link
Contributor

@ndrs-pst ndrs-pst commented Nov 6, 2024

This PR introduces several changes to the cfb subsystem,
focusing on code cleanup as outlined below:

  • cfb: avoid multiple strlen calls in draw_text
  • cfb: remove unnecessary NULL check and NULL assignment
  • cfb_shell: use shell_strtol in cmd_set_kerning
  • cfb_shell: remove dev null check

jfischer-no
jfischer-no previously approved these changes Nov 6, 2024
Added `len` to store the result of `strlen(str)` to avoid
multiple calls to `strlen` in the `for-loop`.

Signed-off-by: Pisit Sawangvonganan <[email protected]>
Since the `fb` pointer is always assigned to `char_fb`, there is no need
for a `NULL` check. Additionally, removed setting `fb->buf` to `NULL` in
`cfb_framebuffer_init` as it will be overwritten by subsequent operations.

Signed-off-by: Pisit Sawangvonganan <[email protected]>
Switch from using direct `strtol` calls to `shell_strtol`.
This change leverages the extensive error handling provided
by `shell_strtol`.

Signed-off-by: Pisit Sawangvonganan <[email protected]>
Remove `dev` null check as `DEVICE_DT_GET` ensures compile-time
initialization.
Refer to commit 6eb371f (fb: initialize devices at compile time)

Signed-off-by: Pisit Sawangvonganan <[email protected]>
Copy link
Member

@soburi soburi left a comment

Choose a reason for hiding this comment

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

LGTM

@nashif nashif merged commit effe4bb into zephyrproject-rtos:main Nov 16, 2024
23 checks passed
@ndrs-pst ndrs-pst deleted the pr_fb_cfb_refactor branch November 17, 2024 08:35
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.

5 participants