[#1147] Copying RVALUE — why the lucky stiff <ruby-core@...>

Hello, everyone. Hope you are all doing well.

18 messages 2003/06/17
[#1155] Re: Copying RVALUE — matz@... (Yukihiro Matsumoto) 2003/06/20

Hi,

[#1157] Re: Copying RVALUE — why the lucky stiff <ruby-core@...> 2003/06/20

Yukihiro Matsumoto (matz@ruby-lang.org) wrote:

[#1173] class.c code cleanup (rb_class_*_instance_methods) — Matthew Dempsky <jivera@...>

Hi, I'm new to this mailing list so I don't know the procedure for

15 messages 2003/06/22
[#1174] Re: [Patch] class.c code cleanup (rb_class_*_instance_methods) — nobu.nokada@... 2003/06/22

Hi,

[#1175] Re: [Patch] class.c code cleanup (rb_class_*_instance_methods) — Matthew Dempsky <jivera@...> 2003/06/22

On Sun, 2003-06-22 at 05:36, nobu.nokada@softhome.net wrote:

[#1176] Re: [Patch] class.c code cleanup (rb_class_*_instance_methods) — nobu.nokada@... 2003/06/22

Hi,

[#1193] Re: [Patch] class.c code cleanup (rb_class_*_instance_methods) — Matthew Dempsky <jivera@...> 2003/06/25

On Sun, 2003-06-22 at 07:41, nobu.nokada@softhome.net wrote:

[#1177] Re: In 1.8.0 nil.to_s is not the same as "" — ts <decoux@...>

14 messages 2003/06/22

Re: In 1.8.0 nil.to_s is not the same as ""

From: Mathieu Bouchard <matju@...>
Date: 2003-06-22 18:40:02 UTC
List: ruby-core #1187
On Mon, 23 Jun 2003, Yukihiro Matsumoto wrote:

> | The problem is not here : do someone has verified *all* the use of
> | RSTRING(str)->ptr in ruby ?
> I assumed tests should be done before releasing 1.8 when I changed ptr
> value to be NULL for empty strings.  Apparently it's not true, so that
> I will fill "" for ptr again for 1.8.0.

If you want to save memory, then instead of pointing to NULL, it could be
pointed to a global buffer containing only a \0, e.g.:

const char *const rb_str_empty = "";

[...]
RSTRING(str)->ptr = rb_str_empty;

or something like that.

the fact it's global is shared does not really matter except that no
attempt should be made to deallocate it. Whenever the string is grown, the
->ptr gets overwritten with a freshly allocated buffer.

________________________________________________________________
Mathieu Bouchard                       http://artengine.ca/matju


In This Thread