Skip to content

Use usbi_ helper functions behind macro aliases - #1

Closed
Youw wants to merge 4 commits into
seanm:macros-functionsfrom
Youw:pr1729-lowercase-helper-aliases
Closed

Use usbi_ helper functions behind macro aliases#1
Youw wants to merge 4 commits into
seanm:macros-functionsfrom
Youw:pr1729-lowercase-helper-aliases

Conversation

@Youw

@Youw Youw commented Jul 15, 2026

Copy link
Copy Markdown

Renames the parent PR's new static inline helpers to lower_snake_case usbi_* names.

Keeps each existing uppercase macro as a forwarding alias, so in-tree macro call sites and existing private-header consumers retain their current spelling.

Related to libusb#1729

Assisted-by: Codex:GPT-5

seanm and others added 4 commits July 14, 2026 13:34
- For USBI_TRANSFER_TO_TRANSFER_PRIV use void* as the return type since indeed the struct is different for each backend, and not a char*
- For USBI_TRANSFER_TO_LIBUSB_TRANSFER, use the size from usbi_backend.transfer_priv_size, just like the inverse macro does. This makes things symetric and makes it possible to convert this to a function since `struct usbi_transfer` is not a macro parameter, but just resolved after preprocessing
Only 1 caller needed to be changed, since it was not acting as a function.

Functions provide type safety vs macros, and macros are renowned footguns.
@Youw
Youw marked this pull request as ready for review July 15, 2026 15:52
@seanm
seanm force-pushed the macros-functions branch from a6f9da6 to ae01520 Compare July 27, 2026 21:18
@Youw

Youw commented Jul 28, 2026

Copy link
Copy Markdown
Author

I see you've implemented on your own, closing

@Youw Youw closed this Jul 28, 2026
@Youw
Youw deleted the pr1729-lowercase-helper-aliases branch July 28, 2026 17:22
@seanm

seanm commented Jul 28, 2026

Copy link
Copy Markdown
Owner

I see you've implemented on your own

It was faster than figuring out the necessary git commands. I copy pasted your backwards compatible macros though, thanks for making them.

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.

2 participants