Skip to content
Browse files

Follow MacRuby style guidelines with stack-passing blocks in struct.c

  • Loading branch information...
1 parent e80a075 commit 3c06b542bfb0d429cb92daf083806203186a0932 @macrotis committed
Showing with 13 additions and 13 deletions.
  1. +13 −13 struct.c
View
26 struct.c
@@ -166,19 +166,19 @@ make_struct(VALUE name, VALUE members, VALUE klass)
ID id = SYM2ID(RARRAY_AT(members, i));
if (rb_is_local_id(id) || rb_is_const_id(id)) {
long j = i; /* Needed for block data reference. */
- /* Struct attribute reader */
- rb_objc_define_method(nstr, rb_id2name(id),
- pl_imp_implementationWithBlock(^(VALUE obj) {
- return RSTRUCT_PTR(obj)[j];
- }), 0);
- /* Struct attribute writer */
- rb_objc_define_method(nstr, rb_id2name(rb_id_attrset(id)),
- pl_imp_implementationWithBlock(^(VALUE obj, VALUE val) {
- VALUE *ptr = RSTRUCT_PTR(obj);
- rb_struct_modify(obj);
- GC_WB(&ptr[i], val);
- return val;
- }), 1);
+ /* Struct attribute reader */
+ rb_objc_define_method(nstr, rb_id2name(id),
+ pl_imp_implementationWithBlock(^(VALUE obj) {
+ return RSTRUCT_PTR(obj)[j];
+ }), 0);
+ /* Struct attribute writer */
+ rb_objc_define_method(nstr, rb_id2name(rb_id_attrset(id)),
+ pl_imp_implementationWithBlock(^(VALUE obj, VALUE val) {
+ VALUE *ptr = RSTRUCT_PTR(obj);
+ rb_struct_modify(obj);
+ GC_WB(&ptr[i], val);
+ return val;
+ }), 1);
}
}

0 comments on commit 3c06b54

Please sign in to comment.
Something went wrong with that request. Please try again.