Skip to content

Remove old visit subcommand#1129

Merged
marcoroth merged 1 commit intomarcoroth:mainfrom
citizen428:remove-visit-subcommand
Feb 6, 2026
Merged

Remove old visit subcommand#1129
marcoroth merged 1 commit intomarcoroth:mainfrom
citizen428:remove-visit-subcommand

Conversation

@citizen428
Copy link
Contributor

Rationale:
While reading main.c I noticed a subcommand called visit, which was not documented in herb's help:

    printf("./herb lex [file]      -  Lex a file\n");
    printf("./herb parse [file]    -  Parse a file\n");
    printf("./herb ruby [file]     -  Extract Ruby from a file\n");
    printf("./herb html [file]     -  Extract HTML from a file\n");
    printf("./herb prism [file]    -  Extract Ruby from a file and parse the Ruby source with Prism\n");

@marcoroth clarified that this is a leftover from the early days of Herb, so this PR removes the subcommand.

Copy link
Owner

@marcoroth marcoroth left a comment

Choose a reason for hiding this comment

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

Thanks! 🙏🏼

@marcoroth marcoroth merged commit 32e0f9a into marcoroth:main Feb 6, 2026
24 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants