[ruby-core:32878] Re: [Ruby 1.9-Bug#3783][Open] Replace Calls to rb_error_frozen() with rb_check_frozen()

From: SASADA Koichi <ko1@...>
Date: 2010-10-21 15:17:14 UTC
List: ruby-core #32878
Hi,

(2010/09/02 13:20), Run Paint Run Run wrote:
> This patch replaces lines of the form:
>   if (OBJ_FROZEN(obj)) rb_error_frozen("object");
> with:
>   rb_check_frozen(obj);
> This is simpler, and produces error messages that are more consistent and precise.
> 
> (It feels wrong cluttering the bug tracker with things like this. Would they be better posted to the list or sent as a "pull" request?)

I agree about this modification.
How about to make a macro to avoid C function call overhead?

example:

#define RB_CHECK_FROZEN(obj) \
  (OBJ_FROZEN(obj) ? rb_error_frozen(rb_obj_classname(obj) : 0)

more simply:

#define rb_check_frozen(obj) \
  (OBJ_FROZEN(obj) ? rb_error_frozen(rb_obj_classname(obj) : 0)

-- 
// SASADA Koichi at atdot dot net

In This Thread

Prev Next