[Spice-devel] [PATCH spice-streaming-agent 2/2] Add a macro to deal with the boilerplate of writing a streaming agent plugin
Frediano Ziglio
fziglio at redhat.com
Thu Nov 23 11:26:10 UTC 2017
>
> From: Christophe de Dinechin <dinechin at redhat.com>
>
> Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
> ---
> include/spice-streaming-agent/plugin.hpp | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/include/spice-streaming-agent/plugin.hpp
> b/include/spice-streaming-agent/plugin.hpp
> index 1a58856..c370eab 100644
> --- a/include/spice-streaming-agent/plugin.hpp
> +++ b/include/spice-streaming-agent/plugin.hpp
> @@ -149,6 +149,14 @@ extern "C" unsigned
> spice_streaming_agent_plugin_interface_version;
> */
> extern "C" SpiceStreamingAgent::PluginInitFunc
> spice_streaming_agent_plugin_init;
>
> +#define SPICE_STREAMING_AGENT_PLUGIN(agent) \
> + __attribute__ ((visibility ("default"))) \
> + unsigned spice_streaming_agent_plugin_interface_version = \
> + SpiceStreamingAgent::PluginInterfaceVersion; \
> + \
> + __attribute__ ((visibility ("default"))) \
> + bool spice_streaming_agent_plugin_init(SpiceStreamingAgent::Agent*
> agent)
> +
> #endif
>
> #endif // SPICE_STREAMING_AGENT_PLUGIN_HPP
Surely helps. Some notes:
- spice_streaming_agent_plugin_interface_version is not const so I assume
you want to allow to change it;
- the attribute is GCC syntax but can be changed if needed;
- I know we use that style of indentation for line continuation but I
honestly prefer to not have that indentation preferring a " \" at the
end. This as current style:
- is hard to maintain. Currently is already broken as last like is
wrong;
- it make copy&paste harder unless you indent always at a given
standard column;
- make email patch potentially hard to read.
Frediano
More information about the Spice-devel
mailing list