[libvirt] [libvirt-glib][PATCH v2] Use new GObject define macros with private

Michal Privoznik mprivozn at redhat.com
Thu Aug 16 12:37:40 UTC 2018


On 08/16/2018 12:24 PM, Andrea Bolognani wrote:
> On Thu, 2018-08-16 at 10:06 +0200, Michal Privoznik wrote:
> [...]
>> -GLIB2_REQUIRED=2.36.0
>> +GLIB2_REQUIRED=2.38.0
>>  AC_SUBST([GLIB2_REQUIRED]) dnl used in the .spec file
>>  GLIB2_TEST_REQUIRED=2.38.0
> 
> We can now get rid of GLIB2_TEST_REQUIRED. Would you mind sending
> a follow-up patch that does that?

Okay.

> 
> [...]
>>  static void gvir_config_capabilities_cpu_class_init(GVirConfigCapabilitiesCpuClass *klass)
>>  {
>> -    g_type_class_add_private(klass, sizeof(GVirConfigCapabilitiesCpuPrivate));
>>  
> 
> Drop the empty line here.
> 
> [...]
>> @@ -47,7 +47,6 @@ static void gvir_config_domain_cpu_class_init(GVirConfigDomainCpuClass *klass)
>>      capabilities_class = GVIR_CONFIG_CAPABILITIES_CPU_CLASS(klass);
>>      capabilities_class->get_features = _gvir_config_domain_cpu_get_features;
>>  
> 
> Drop the empty line here.
> 
> [...]
>>  static void gvir_config_domain_power_management_class_init
>> -        (GVirConfigDomainPowerManagementClass *klass)
>> +        (GVirConfigDomainPowerManagementClass *klass G_GNUC_UNUSED)
> 
> Weird formatting here, maybe fix it while you're at it?

Okay.

> 
> [...]


> [...]
>> -#define gvir_output_stream_get_type _gvir_output_stream_get_type
>> -G_DEFINE_TYPE(GVirOutputStream, gvir_output_stream, G_TYPE_OUTPUT_STREAM);
>> -
>>  enum
>>  {
>>      PROP_0,
>> @@ -50,6 +47,9 @@ struct _GVirOutputStreamPrivate
>>      gsize count;
>>  };
>>  
>> +#define gvir_output_stream_get_type _gvir_output_stream_get_type
>> +G_DEFINE_TYPE_WITH_PRIVATE(GVirOutputStream, gvir_output_stream, G_TYPE_OUTPUT_STREAM);
>> +
> 
> Why did this move around? :D Update it in place please.

Becasue G_DEFINE_TYPE_WITH_PRIVATE needs the private data struct to
exist at the point where it is called:

libvirt-gobject-output-stream.c: In function '_gvir_output_stream_get_type':
libvirt-gobject-output-stream.c:35:28: error: invalid application of
'sizeof' to incomplete type 'GVirOutputStreamPrivate {aka struct
_GVirOutputStreamPrivate}'



> 
> With the above addressed
> 
>   Reviewed-by: Andrea Bolognani <abologna at redhat.com>
> 

Pushed, thanks.

Michal




More information about the libvir-list mailing list