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

Re: [Xen-devel] [PATCH v3 1/8] golang/xenlight: Don't try to marshall zero-length arrays in fromC



 Sorry I didn't catch this the first time around, but:

> diff --git a/tools/golang/xenlight/helpers.gen.go 
> b/tools/golang/xenlight/helpers.gen.go
> index b9a7e828a0..889807d928 100644
> --- a/tools/golang/xenlight/helpers.gen.go
> +++ b/tools/golang/xenlight/helpers.gen.go
> @@ -623,12 +623,14 @@ func (x *SchedParams) toC(xc *C.libxl_sched_params) 
> (err error) {
>
>  func (x *VcpuSchedParams) fromC(xc *C.libxl_vcpu_sched_params) error {
>         x.Sched = Scheduler(xc.sched)
> -       numVcpus := int(xc.num_vcpus)
> -       cVcpus := (*[1 << 
> 28]C.libxl_sched_params)(unsafe.Pointer(xc.vcpus))[:numVcpus:numVcpus]
> -       x.Vcpus = make([]SchedParams, numVcpus)
> -       for i, v := range cVcpus {
> -               if err := x.Vcpus[i].fromC(&v); err != nil {
> -                       return err
> +       x.Vcpus = nil
> +       if numVcpus := int(xc.num_vcpus); numVcpus > 0 {


Since `numX` is now scoped to this if block, we could probably just
use `n` or similar and then drop `golenvar` from
`xenlight_golang_array_fromC`. It would remove some pretty ugly
variable names from the generated code :)

-NR

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.