[Spice-devel] [PATCH spice-gtk 06/15] webdav: move initialization to session

Jonathon Jongsma jjongsma at redhat.com
Wed Nov 26 07:53:33 PST 2014


On Wed, 2014-11-26 at 13:58 +0100, Marc-André Lureau wrote:
> Hi
> 
> On Tue, Nov 25, 2014 at 11:49 PM, Jonathon Jongsma <jjongsma at redhat.com> wrote:
> > I find this name a little inconsistent. Generally the first part of the
> > function name indicates the type of object that this method belongs to.
> 
> Except constructors, like here.

But the convention for constructors is that the name of the function
matches the name of the returned type. For example:

FooType* foo_type_new()

So I would expect a constructor named channel_webdav_server_new() to
return an object of type ChannelWebdavServer rather than PhodavServer. I
realize this might sound pedantic, but it does make it easier to
understand the code at a glance if conventions are followed. What about
something like phodav_server_new_for_spice_session() ?

> 
> > So I'd expect channel_webdav_server_new() to take a SpiceWebdavChannel*
> > as its first argument, but it takes a SpiceSession* instead. So it seems
> > that spice_session_webdav_server_new() would be a more appropriate name?
> > Maybe even move it along to spice-session.c since its only caller just
> > got moved there?
> 
> It can't easily, the constructor sets up callback in channel-webdav.
> 

ok




More information about the Spice-devel mailing list