djberg96
11/10/2004 6:07:00 PM
Hi all,
I find I'm often doing something like this:
static VALUE foofoo(int argc, VALUE* argv, VALUE self)
char* foo;
VALUE rbFoo;
...
rb_scan_args(argc,argv,"01",&rbFoo);
if(NIL_P(rbFoo)){
foo = NULL;
}
else{
foo = StringValuePtr(rbFoo);
}
some_C_function(foo);
return WHATEVER;
}
/* END */
Is there a way to reduce this to a single step? Can we modify
StringValuePtr() to return NULL if its argument is nil? Or would that
break too many things?
Regards,
Dan