Skip to content

fix: remove redundant obj variable in allocator functions#8

Merged
takaokouji merged 1 commit into
smalruby/ruby-3.4-supportfrom
fix/typed-data-redundant-obj
Apr 2, 2026
Merged

fix: remove redundant obj variable in allocator functions#8
takaokouji merged 1 commit into
smalruby/ruby-3.4-supportfrom
fix/typed-data-redundant-obj

Conversation

@takaokouji
Copy link
Copy Markdown

Summary

Address review feedback from upstream PR (ohai#30) to remove redundant obj variable assignments in allocator functions.

Changes Made

  • video.c.m4: Remove redundant VALUE obj in DisplayMode_s_allocate, Rect_s_allocate, and Point_s_allocate — return TypedData_Make_Struct(...) directly instead of assigning to a temporary variable.

These functions only call TypedData_Make_Struct and immediately return the result, so the intermediate variable adds no value.

Functions where obj is used before return (e.g., Renderer_new, Window_new) are unchanged per reviewer guidance.

Verification

  • Build compiles successfully with ruby extconf.rb && make

Return TypedData_Make_Struct directly instead of assigning to a
temporary variable in DisplayMode_s_allocate, Rect_s_allocate,
and Point_s_allocate where obj is not used before return.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@takaokouji takaokouji merged commit 4d153ad into smalruby/ruby-3.4-support Apr 2, 2026
@takaokouji takaokouji deleted the fix/typed-data-redundant-obj branch April 2, 2026 15:13
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.

1 participant