[Spice-devel] [spice-xpi 10/12] Add helper function to get client paths

Christophe Fergeau cfergeau at redhat.com
Tue Mar 12 06:55:55 PDT 2013


On Tue, Mar 12, 2013 at 01:32:13PM +0100, Marc-André Lureau wrote:
> On Tue, Mar 12, 2013 at 12:23 PM, Christophe Fergeau
> <cfergeau at redhat.com> wrote:
> > void SpiceController::GetClientPaths(GStrv *client_argv, GStrv *fallback_argv)
> > +{
> > +    if (client_argv != NULL) {
> > +        *client_argv = g_new0(char *, 2);
> > +        (*client_argv)[0] = g_strdup("/usr/libexec/spice-xpi-client");
> > +    }
> > +
> > +    if (fallback_argv != NULL) {
> > +        *client_argv = g_new0(char *, 3);
> > +        (*client_argv)[0] = g_strdup("/usr/bin/spicec");
> > +        (*client_argv)[1] = g_strdup("--controller");
> > +    }
> > +}
> 
> any reason this needs to be allocated? I would rather see a static const array.

Yup, the Windows version of this function will be using dynamic allocation
as we need to get the client name from the registry, split it, ...
see
http://cgit.freedesktop.org/~teuf/spice-xpi/tree/SpiceXPI/src/plugin/controller-win.cpp?h=mingw#n151

> Also, I don't see why it should be returned by the same function.

Good point, I can split it.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130312/89c2f530/attachment.pgp>


More information about the Spice-devel mailing list