Skip to content

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

Open
arturobernalg wants to merge 1 commit into
apache:trunkfrom
arturobernalg:ARRAY_LEN-macro
Open

arturobernalg wants to merge 1 commit into
apache:trunkfrom
arturobernalg:ARRAY_LEN-macro

Conversation

@arturobernalg

Copy link
Copy Markdown
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

notroj commented Mar 6, 2025

Copy link
Copy Markdown
Collaborator

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 :)

@arturobernalg

Copy link
Copy Markdown
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
Copy Markdown

Also thanks from my side!

@notroj

notroj commented Mar 18, 2025 •

Copy link
Copy Markdown
Collaborator

Can you make your fork writable by committers? I'd like to test a couple of additional changes to this.

@arturobernalg

Copy link
Copy Markdown
Member Author

Sorry this fell off my radar. I'm going to refresh this against current trunk and re-check all the call sites. I'll also enable maintainer edits so you can make the additional changes you had in mind.

Add AP_ARRAY_LEN() to ap_config.h and use it instead of
sizeof(a) / sizeof((a)[0]) where a is a fixed-size array.
Remove the local H2_ALEN() macros replaced by AP_ARRAY_LEN().
@arturobernalg arturobernalg changed the title ### Macro to Simplify Array Length Calculation (Revived from PR #401) core: Add AP_ARRAY_LEN() macro Oct 15, 2026
@arturobernalg arturobernalg changed the title core: Add AP_ARRAY_LEN() macro Macro to Simplify Array Length Calculation (Revived from PR #401) Oct 15, 2026
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