On 1/4/20 9:00 PM, Nick Rosbrook wrote:
> Implement conversions for basic types such as strings and integer
> types in toC functions.
>
> Modify function signatures of toC implementations for builtin
> types to be consistent with the signature of the generated toC
> functions.
>
> Signed-off-by: Nick Rosbrook <[email protected]>
> ---
> Changes in v5:
> - Define xenlight_golang_convert_to_C so that field conversion code
> can be easily re-used.
> - Check for err in defer'd func within toC to determine if the dispose
> function needs to be called.
> - Pass a reference to the C type in toC, rather than returning a copy
> of the C variable.
> - Update the existing toC functions for builtin types to be consistent
> with the generated functions.
> - Only call CString if the Go string is non-empty.
Looks good! Only one question:
> + if not is_castable:
> + s += 'if err := x.{}.toC(&xc.{}); err != nil
> {{\n'.format(goname,cname)
Err should be defined function-wide at this point. Are you using `:=`
on purpose for some reason? Would it make sense to make this `=` instead?
If we want to, I can change that on check-in; so either way:
Reviewed-by: George Dunlap <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel