Re: [libvirt] [PATCH]: ruby-libvirt migration fixes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2008-08-08 at 16:22 +0200, Chris Lalancette wrote:
> Jim Meyering wrote:
> >> diff -r c6a3e36cdf54 ext/libvirt/_libvirt.c
> >> --- a/ext/libvirt/_libvirt.c	Thu Jul 17 15:24:26 2008 -0700
> >> +++ b/ext/libvirt/_libvirt.c	Fri Aug 08 06:04:56 2008 -0400
> >> @@ -637,16 +637,51 @@ VALUE libvirt_conn_num_of_defined_storag
> >>  }
> >>  #endif
> >>
> >> +static char *get_string_or_nil(VALUE arg)
> >> +{
> >> +    if (TYPE(arg) == T_NIL)
> >> +        return NULL;
> >> +    else if (TYPE(arg) == T_STRING)
> >> +        return STR2CSTR(arg);
> > 
> > STR2CSTR is marked as obsolete in ruby.h, where it says
> > to use StringValuePtr instead:
> > 
> >     /* obsolete API - use StringValuePtr() */
> >     #define STR2CSTR(x) rb_str2cstr((VALUE)(x),0)
> 
> Yeah, you are right.  I looked through the ruby source code, actually, and I
> ended up using StringValueCStr (which is used elsewhere in the ruby-libvirt
> bindings).  It's basically the same as StringValuePtr, but does an additional
> check to make sure the string is not of 0 length and that there aren't
> additional embedded \0 in the string.
> 
> I also updated the patch with the const pointers as you suggested.  Attached.
> Thanks for the review!

ACK .. committed.

I'll try and roll a new release tomorrow.

David


--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]