Skip to content

mruby-encoding: drop the unused utf8_islead macro - #7095

Merged
matz merged 1 commit into
mruby:masterfrom
takumin:encoding-unused-utf8-islead
Aug 12, 2026
Merged

mruby-encoding: drop the unused utf8_islead macro#7095
matz merged 1 commit into
mruby:masterfrom
takumin:encoding-unused-utf8-islead

Conversation

@takumin

@takumin takumin commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

mrbgems/mruby-encoding/src/encoding.c defines utf8_islead at the head of
str_valid_enc_p, but the function never expands it. The macro has been dead
since the gem was added in 74bdae9 (mruby-encoding: add Poorman's Encoding gem): str_valid_enc_p asks mrb_utf8len for the length of each character
and rejects a stray byte with the len == 1 && (*p & 0x80) test, so it never
inspects a continuation byte on its own.

src/string.c carries its own definition of the same name and keeps using it,
as does mirb_buffer.c. This change touches only the unused copy in the gem.

No behavior change. rake builds clean.

Summary by CodeRabbit

  • Chores
    • Removed unused internal code without changing encoding validation or observable behavior.

`str_valid_enc_p` defines `utf8_islead` at its head but never expands it.
The macro has been dead since the gem was added in 74bdae9: the function
asks `mrb_utf8len` for the length of each character and rejects a stray
byte with the `len == 1 && (*p & 0x80)` test, so it never inspects a
continuation byte on its own.

`src/string.c` defines a macro of the same name and still uses it. This
change touches only the unused copy in the gem.
@takumin
takumin requested a review from matz as a code owner August 12, 2026 02:46
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8ac29e79-a88a-415b-b0c8-aa62c69f669f

📥 Commits

Reviewing files that changed from the base of the PR and between 77eca77 and b08bcd2.

📒 Files selected for processing (1)
  • mrbgems/mruby-encoding/src/encoding.c
💤 Files with no reviewable changes (1)
  • mrbgems/mruby-encoding/src/encoding.c

📝 Walkthrough

Walkthrough

Removed the unused utf8_islead macro from the encoding implementation. Public behavior remains unchanged.

Changes

Cohort / File(s) Summary
Encoding cleanup
mrbgems/mruby-encoding/src/encoding.c
Removes the unused utf8_islead macro. Encoding validation remains unchanged.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: matz

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the removal of the unused utf8_islead macro.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@matz
matz merged commit 9fc64e5 into mruby:master Aug 12, 2026
21 checks passed
@takumin
takumin deleted the encoding-unused-utf8-islead branch August 12, 2026 03:44
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