Project

General

Profile

Feature #4893 ยป String_call_initialize_v3b.diff

Corrected a merge-error in the patch v3 - lazaridis.com (Lazaridis Ilias), 07/04/2011 09:11 PM

View differences:

"b/C:\\Users\\LAZARI~1\\AppData\\Local\\Temp\\strA4D8.c"
406 406
    return str;
407 407
}
408 408

  
409
#define FL_CALL_INIT FL_USER18
410

  
411
VALUE
412
rb_str_call_initialize_get(VALUE self)
413
{
414
    if (FL_TEST(rb_cString, FL_CALL_INIT)) return Qtrue;
415
    return Qfalse;
416
}
417

  
418
VALUE
419
rb_str_call_initialize_set(VALUE self, VALUE val)
420
{
421
	FL_UNSET(rb_cString, FL_CALL_INIT);
422
    if (val == Qtrue) FL_SET(rb_cString, FL_CALL_INIT);
423
	
424
    return self;
425
}
426

  
409 427
VALUE
410 428
rb_str_new(const char *ptr, long len)
411 429
{
412
    return str_new(rb_cString, ptr, len);
430
    VALUE str;
431
    VALUE argv[1];
432

  
433
    str = str_new(rb_cString, ptr, len);
434

  
435
    if (FL_TEST(rb_cString, FL_CALL_INIT)) {
436
	argv[0] = (VALUE)str;
437
	rb_obj_call_init((VALUE)str, 1, argv);
438
    }
439

  
440
    return str;
413 441
}
414 442

  
415 443
VALUE
......
7724 7752
    rb_cString  = rb_define_class("String", rb_cObject);
7725 7753
    rb_include_module(rb_cString, rb_mComparable);
7726 7754
    rb_define_alloc_func(rb_cString, str_alloc);
7755

  
7756
    rb_define_singleton_method(rb_cString, "call_initialize", rb_str_call_initialize_get, 0);
7757
    rb_define_singleton_method(rb_cString, "call_initialize=", rb_str_call_initialize_set, 1);
7758

  
7727 7759
    rb_define_singleton_method(rb_cString, "try_convert", rb_str_s_try_convert, 1);
7728 7760
    rb_define_method(rb_cString, "initialize", rb_str_init, -1);
7729 7761
    rb_define_method(rb_cString, "initialize_copy", rb_str_replace, 1);