Bug #3783
Replace Calls to rb_error_frozen() with rb_check_frozen()
| Status: | Closed | Start date: | 09/02/2010 | |
|---|---|---|---|---|
| Priority: | Low | Due date: | ||
| Assignee: | - | % Done: | 100% |
|
| Category: | core | |||
| Target version: | - | |||
| ruby -v: | ruby 1.9.3dev (2010-09-02 trunk 29167) [i686-linux] |
Description
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?)
Associated revisions
* array.c, gc.c, hash.c, object.c, string.c, struct.c,
transcode.c, variable.c, vm.c, vm_insnhelper.c, vm_method.c:
replace calls to rb_error_frozen() with rb_check_frozen(). a
patch from Run Paint Run Run at [ruby-core:32014]
History
Updated by ko1 (Koichi Sasada) over 1 year ago
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
Updated by nobu (Nobuyoshi Nakada) over 1 year ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r29583. Run Paint, thank you for reporting this issue. Your contribution to Ruby is greatly appreciated. May Ruby be with you.