[#3726] Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...>

Hi --

15 messages 2004/11/12
[#3749] Re: Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...> 2004/11/16

Hi --

[#3751] Re: Fixnum#clone and Float#clone raise different exceptions — Yukihiro Matsumoto <matz@...> 2004/11/16

Hi,

[#3752] Re: Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...> 2004/11/16

Hi --

[#3785] The latest 1.8.2 cvs prints parse error when starting extension compiling — Yukihiro Matsumoto <matz@...>

Hi,

13 messages 2004/11/23
[#3787] Re: The latest 1.8.2 cvs prints parse error when starting extension compiling — Johan Holmberg <holmberg@...> 2004/11/23

Re: Converting nil to NULL

From: Charles Mills <cmills@...>
Date: 2004-11-11 16:26:52 UTC
List: ruby-core #3712
On Nov 11, 2004, at 8:07 AM, Berger, Daniel wrote:

> Hi all,
>
> Is there a way to reduce this to a single step?  Can we modify
> StringValuePtr() to return NULL if its argument is nil?

You could create you own version:

char *
my_string_value_ptr(ptr)
     volatile VALUE *ptr;
{
	if (NIL_P(*ptr)) return NULL;
	return RSTRING(rb_string_value(ptr))->ptr;
}

#define MyStringValuePtr(s) my_string_value_ptr(&(s))

> Or would that
> break too many things?
>

That would sure break *alot* of my code :)

-Charlie


In This Thread