Re: [Safer] rb_class_path

From: nobu.nokada@...
Date: 2002-08-27 18:56:17 UTC
List: ruby-core #373
Hi,

At Wed, 28 Aug 2002 01:05:55 +0900,
Michal Rokos wrote:
> -	sprintf(buf, "#<%s:0x%lx>", s, klass);
> -	return rb_str_new2(buf);
  +	str = rb_str_new(0, 2 + strlen(s) + 3 + SIZEOF_LONG * 2 + 1 + 1);
> +	snprintf(RSTRING(str)->ptr, RSTRING(str)->len, "#<%s:0x%lx>", s, klass);
  +	RSTRING(str)->len = strlen(RSTRING(str)->ptr);
> +	
> +	return str;
>      }
>  }

-- 
Nobu Nakada

In This Thread