lib: add struct paddings to be able to maintain ABI compatibility

Aim for 8 pointers on each struct, wich exceptions:
- 12 pointers for already crowded/important ones
- 4 pointers for empty ones that are used for proxies; we are
  unlikely to add any virtual methods on these classes ever
This commit is contained in:
George Kiagiadakis
2021-06-08 17:38:14 +03:00
parent 72297e0909
commit f9767d19a6
14 changed files with 51 additions and 0 deletions

View File

@@ -2222,6 +2222,7 @@ PREDEFINED = DOXYGEN_DOCUMENTATION_BUILD \
WP_API= \
WP_PRIVATE_API= \
WP_PLUGIN_EXPORT= \
WP_PADDING(...)= \
G_GNUC_CONST= \
G_GNUC_PRINTF(...)= \
G_GNUC_NULL_TERMINATED= \

View File

@@ -30,6 +30,9 @@ struct _WpComponentLoaderClass
gboolean (*load) (WpComponentLoader * self, const gchar * component,
const gchar * type, GVariant * args, GError ** error);
/*< private >*/
WP_PADDING(6)
};
G_END_DECLS

View File

@@ -35,4 +35,6 @@
# endif
#endif
#define WP_PADDING(n) gpointer _wp_padding[n];
#endif

View File

@@ -28,6 +28,9 @@ G_DECLARE_DERIVABLE_TYPE (WpEndpoint, wp_endpoint, WP, ENDPOINT, WpGlobalProxy)
struct _WpEndpointClass
{
WpGlobalProxyClass parent_class;
/*< private >*/
WP_PADDING(4)
};
WP_API

View File

@@ -26,6 +26,9 @@ G_DECLARE_DERIVABLE_TYPE (WpGlobalProxy, wp_global_proxy,
struct _WpGlobalProxyClass
{
WpProxyClass parent_class;
/*< private >*/
WP_PADDING(4)
};
WP_API

View File

@@ -34,6 +34,9 @@ G_DECLARE_DERIVABLE_TYPE (WpMetadata, wp_metadata, WP, METADATA, WpGlobalProxy)
struct _WpMetadataClass
{
WpGlobalProxyClass parent_class;
/*< private >*/
WP_PADDING(4)
};
WP_API

View File

@@ -74,6 +74,9 @@ struct _WpObjectClass
WpObjectFeatures missing);
void (*deactivate) (WpObject * self, WpObjectFeatures features);
/*< private >*/
WP_PADDING(8)
};
WP_API

View File

@@ -36,6 +36,9 @@ struct _WpPluginClass
void (*enable) (WpPlugin * self, WpTransition * transition);
void (*disable) (WpPlugin * self);
/*< private >*/
WP_PADDING(6)
};
WP_API

View File

@@ -46,6 +46,9 @@ struct _WpPipewireObjectInterface
gboolean (*set_param) (WpPipewireObject * self, const gchar * id,
guint32 flags, WpSpaPod * param);
/*< private >*/
WP_PADDING(5)
};
WP_API

View File

@@ -81,6 +81,9 @@ struct _WpProxyClass
void (*pw_proxy_destroyed) (WpProxy * self);
void (*bound) (WpProxy * self, guint32 id);
void (*error) (WpProxy * self, int seq, int res, const char *message);
/*< private >*/
WP_PADDING(6)
};
WP_API

View File

@@ -54,6 +54,9 @@ struct _WpSessionItemClass
void (*enable_active) (WpSessionItem * self, WpTransition * transition);
/*! enables the exported feature of the session item */
void (*enable_exported) (WpSessionItem * self, WpTransition * transition);
/*< private >*/
WP_PADDING(5)
};
/* Id */

View File

@@ -27,6 +27,9 @@ struct _WpSiFactoryClass
GObjectClass parent_class;
WpSessionItem * (*construct) (WpSiFactory * self, WpCore * core);
/*< private >*/
WP_PADDING(7)
};
WP_API

View File

@@ -32,6 +32,9 @@ struct _WpSiEndpointInterface
GVariant * (*get_registration_info) (WpSiEndpoint * self);
WpProperties * (*get_properties) (WpSiEndpoint * self);
/*< private >*/
WP_PADDING(6)
};
WP_API
@@ -58,6 +61,9 @@ struct _WpSiAdapterInterface
const gchar *mode, GAsyncReadyCallback callback, gpointer data);
gboolean (*set_ports_format_finish) (WpSiAdapter * self, GAsyncResult * res,
GError ** error);
/*< private >*/
WP_PADDING(5)
};
WP_API
@@ -87,6 +93,9 @@ struct _WpSiLinkableInterface
GVariant * (*get_ports) (WpSiLinkable * self, const gchar * context);
WpSiAcquisition * (*get_acquisition) (WpSiLinkable * self);
/*< private >*/
WP_PADDING(6)
};
WP_API
@@ -114,6 +123,9 @@ struct _WpSiLinkInterface
WpSiLinkable * (*get_out_item) (WpSiLink * self);
WpSiLinkable * (*get_in_item) (WpSiLink * self);
/*< private >*/
WP_PADDING(4)
};
WP_API
@@ -148,6 +160,9 @@ struct _WpSiAcquisitionInterface
void (*release) (WpSiAcquisition * self, WpSiLink * acquisitor,
WpSiLinkable * item);
/*< private >*/
WP_PADDING(5)
};
WP_API

View File

@@ -43,6 +43,9 @@ struct _WpTransitionClass
guint (*get_next_step) (WpTransition * transition, guint step);
/*! See wp_transition_advance() */
void (*execute_step) (WpTransition * transition, guint step);
/*< private >*/
WP_PADDING(6)
};
WP_API