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

2018-08-16 Thread Michal Privoznik
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 
> 

Pushed, thanks.

Michal

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


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

2018-08-16 Thread Andrea Bolognani
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?

[...]
>  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?

[...]
> @@ -128,7 +128,6 @@ static void 
> gvir_config_domain_class_init(GVirConfigDomainClass *klass)
>  {
>  GObjectClass *object_class = G_OBJECT_CLASS(klass);
>  
> -g_type_class_add_private(klass, sizeof(GVirConfigDomainPrivate));
>  

Drop one of the two empty lines here.

[...]
> @@ -90,7 +90,6 @@ static void 
> gvir_config_xml_doc_class_init(GVirConfigXmlDocClass *klass)
>  {
>  GObjectClass *object_class = G_OBJECT_CLASS(klass);
>  
> -g_type_class_add_private(klass, sizeof(GVirConfigXmlDocPrivate));
>  

Drop one of the two empty lines here.

[...]
> @@ -231,7 +231,6 @@ static void 
> gvir_connection_class_init(GVirConnectionClass *klass)
>   1,
>   GVIR_TYPE_DOMAIN);
>  
> -g_type_class_add_private(klass, sizeof(GVirConnectionPrivate));

Drop the empty line here.

[...]
> @@ -135,7 +135,6 @@ static void 
> gvir_domain_device_class_init(GVirDomainDeviceClass *klass)
>  
> G_PARAM_CONSTRUCT_ONLY |
>  
> G_PARAM_STATIC_STRINGS));
>  
> -g_type_class_add_private(klass, sizeof(GVirDomainDevicePrivate));

Drop the empty line here.

[...]
> @@ -126,7 +126,6 @@ static void 
> gvir_domain_snapshot_class_init(GVirDomainSnapshotClass *klass)
> 
> G_PARAM_CONSTRUCT_ONLY |
> 
> G_PARAM_STATIC_STRINGS));
>  
> -g_type_class_add_private(klass, sizeof(GVirDomainSnapshotPrivate));

Drop the empty line here.

[...]
> @@ -247,7 +247,6 @@ static void gvir_domain_class_init(GVirDomainClass *klass)
>  G_TYPE_NONE,
>  0);
>  
> -g_type_class_add_private(klass, sizeof(GVirDomainPrivate));

Drop the empty line here.

[...]
> @@ -196,7 +196,6 @@ static void 
> gvir_input_stream_class_init(GVirInputStreamClass *klass)
>  GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
>  GInputStreamClass *ginputstream_class = G_INPUT_STREAM_CLASS(klass);
>  
> -g_type_class_add_private(klass, sizeof(GVirInputStreamPrivate));
>  

Drop one of the two empty lines here.

[...]
> @@ -126,7 +126,6 @@ static void gvir_interface_class_init(GVirInterfaceClass 
> *klass)
> 
> G_PARAM_CONSTRUCT_ONLY |
> 
> G_PARAM_STATIC_STRINGS));
>  
> -g_type_class_add_private(klass, sizeof(GVirInterfacePrivate));

Drop the empty line here.

[...]
> @@ -102,7 +102,6 @@ static void gvir_manager_class_init(GVirManagerClass 
> *klass)
>   1,
>   GVIR_TYPE_CONNECTION);
>  
> -g_type_class_add_private(klass, sizeof(GVirManagerPrivate));

Drop the empty line here.

[...]
> @@ -124,7 +124,6 @@ static void 
> gvir_network_dhcp_lease_class_init(GVirNetworkDHCPLeaseClass *klass)
>   G_PARAM_PRIVATE |
>   
> G_PARAM_STATIC_STRINGS));
>  
> -g_type_class_add_private(klass, sizeof(GVirNetworkDHCPLeasePrivate));

Drop the empty line here.

[...]
> @@ -142,7 +142,6 @@ static void 
> gvir_network_filter_class_init(GVirNetworkFilterClass *klass)
> 
> G_PARAM_CONSTRUCT_ONLY |
> 
> G_PARAM_STATIC_STRINGS));
>  
> -g_type_class_add_private(klass, sizeof(GVirNetworkFilterPrivate));

Drop the empty line here.

[...]
> @@ -142,7 +142,6 @@ static void gvir_network_class_init(GVirNetworkClass 
> *klass)
> 
> G_PARAM_CONSTRUCT_ONLY |
> 
> G_PARAM_STATIC_STRINGS));
>  

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

2018-08-16 Thread Michal Privoznik
G_ADD_PRIVATE was added in 2.38 and older functions are getting deprecated:
https://gitlab.gnome.org/GNOME/glib/merge_requests/7/commits

This also means, that the minimal required glib version is
increased to 2.38.

Signed-off-by: Michal Privoznik 
---

diff to v1:
- increased minimal glib version in configure.ac

 configure.ac   | 2 +-
 libvirt-gconfig/libvirt-gconfig-capabilities-cpu-feature.c | 5 ++---
 libvirt-gconfig/libvirt-gconfig-capabilities-cpu-model.c   | 5 ++---
 libvirt-gconfig/libvirt-gconfig-capabilities-cpu-topology.c| 5 ++---
 libvirt-gconfig/libvirt-gconfig-capabilities-cpu.c | 3 +--
 libvirt-gconfig/libvirt-gconfig-capabilities-guest-arch.c  | 5 ++---
 libvirt-gconfig/libvirt-gconfig-capabilities-guest-domain.c| 5 ++---
 libvirt-gconfig/libvirt-gconfig-capabilities-guest-feature.c   | 5 ++---
 libvirt-gconfig/libvirt-gconfig-capabilities-guest.c   | 5 ++---
 libvirt-gconfig/libvirt-gconfig-capabilities-host-secmodel.c   | 5 ++---
 libvirt-gconfig/libvirt-gconfig-capabilities-host.c| 5 ++---
 libvirt-gconfig/libvirt-gconfig-capabilities.c | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-address-pci.c   | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-address-usb.c   | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-address.c   | 3 +--
 libvirt-gconfig/libvirt-gconfig-domain-channel.c   | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-chardev-source-pty.c| 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-chardev-source-spiceport.c  | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-chardev-source-spicevmc.c   | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-chardev-source-unix.c   | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-chardev-source.c| 3 +--
 libvirt-gconfig/libvirt-gconfig-domain-chardev.c   | 3 +--
 libvirt-gconfig/libvirt-gconfig-domain-clock.c | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-console.c   | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-controller-usb.c| 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-controller.c| 3 +--
 libvirt-gconfig/libvirt-gconfig-domain-cpu-feature.c   | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-cpu-model.c | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-cpu.c   | 3 +--
 libvirt-gconfig/libvirt-gconfig-domain-device.c| 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-disk-driver.c   | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-disk.c  | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-filesys.c   | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-desktop.c  | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-rdp.c  | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-sdl.c  | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-spice.c| 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-graphics-vnc.c  | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-graphics.c  | 3 +--
 libvirt-gconfig/libvirt-gconfig-domain-hostdev-pci.c   | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-hostdev.c   | 3 +--
 libvirt-gconfig/libvirt-gconfig-domain-input.c | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-interface-bridge.c  | 5 ++---
 .../libvirt-gconfig-domain-interface-filterref-parameter.c | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-interface-filterref.c   | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-interface-network.c | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-interface-user.c| 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-interface.c | 3 +--
 libvirt-gconfig/libvirt-gconfig-domain-memballoon.c| 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-os.c| 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-parallel.c  | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-power-management.c  | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-redirdev.c  | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-seclabel.c  | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-serial.c| 5 ++---
 .../libvirt-gconfig-domain-smartcard-host-certificates.c   | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-smartcard-host.c| 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-smartcard-passthrough.c | 5 ++---
 libvirt-gconfig/libvirt-gconfig-domain-smartcard.c | 3 +--
 libvirt-gconfig/libvirt-gconfig-domain-snapshot-disk.c | 5 ++---