Merged
Conversation
marcoroth
added a commit
that referenced
this pull request
Feb 7, 2026
_Note: this was built on top of #1129, which should be merged first. I didn't want to update the already removed `visit` subcommand._ This PR introduces a string utility function called `string_equals` and updates usages of `strcmp` to use that instead. **Rationale:** While perusing `main.c`, I found the repetitive `strcmp` calls a bit of a nuisance. I originally considered adding the following macro: ```c #define STRING_EQ(a, b) (strcmp((a), (b)) == 0) ``` However, since we're targeting C99, we can also use a `static inline` function instead. **File size considerations:** I built the binary on my machine with both the `strcmp` and `string_equals` versions. As expected, with our production flags, this resulted in no increased binary size as `clang` successfully inlines all the calls. For debug builds, there's an increase of 448 bytes, which I think is a reasonable tradeoff for the increased readability. | Build | `strcmp` | `string_eq` | Diff | |-------|---------------------|-------------|------| | Debug | 841,208 bytes | 841,656 bytes | +448 bytes (+0.05%) | | Production | 649,960 bytes | 649,960 bytes | 0 bytes | **Open question:** Are we actually using the production flags to build releases? The assigned variable is never used in the `Makefile`. --------- Signed-off-by: Marco Roth <marco.roth@intergga.ch> Co-authored-by: Marco Roth <marco.roth@intergga.ch>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale:
While reading
main.cI noticed a subcommand calledvisit, which was not documented inherb's help:@marcoroth clarified that this is a leftover from the early days of Herb, so this PR removes the subcommand.