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

### Macro to Simplify Array Length Calculation (Revived from PR #401) #519

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

Conversation

arturobernalg
Copy link
Member

This PR is based on PR #401, which proposed
adding the ARRAY_LEN macro to improve code readability and maintainability. The original
PR was abandoned and had conflicts, so I have rebased it, resolved issues, and integrated
the changes.

@notroj
Copy link
Collaborator

notroj commented Mar 6, 2025

This looks better - thanks for redoing it - but it should be AP_ARRAY_LEN() rather than just ARRAY_LEN() to avoid namespace conflicts. Hopefully you can change it with a sed command :)

This commit introduces the AP_ARRAY_LEN macro to simplify array length calculations
by replacing occurrences of `sizeof(a)/sizeof(a[0])` with `AP_ARRAY_LEN(a)`.
@arturobernalg
Copy link
Member Author

This looks better - thanks for redoing it - but it should be AP_ARRAY_LEN() rather than just ARRAY_LEN() to avoid namespace conflicts. Hopefully you can change it with a sed command :)

This looks better - thanks for redoing it - but it should be AP_ARRAY_LEN() rather than just ARRAY_LEN() to avoid namespace conflicts. Hopefully you can change it with a sed command :)

Agreed. I've implemented the changes and updated the committee message.

@thomasmey
Copy link

Also thanks from my side!

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.

3 participants