You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Hudson <gh...@MIT.EDU> on 2002/09/02 07:07:37 UTC

Re: [ghudson@MIT.EDU: Re: svn commit: rev 3110 - trunk/subversion/include]

On Mon, 2002-09-02 at 02:45, Gerald Richter wrote:
> I hope this make things more clear, if not just ask again. If I am overseen
> something here and there is a better way to do these things I am happy to
> learn...

Perhaps a hash table mapping the dav_resource pointer to the perl
object?  You'd need some way of cleaning that up when a dav_resource
structure is freed (or rather, when its containing pool is freed), but I
think you'd need that anyway to get the reference counts right.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [ghudson@MIT.EDU: Re: svn commit: rev 3110 -trunk/subversion/include]

Posted by Greg Hudson <gh...@MIT.EDU>.
On Mon, 2002-09-02 at 03:33, Gerald Richter wrote:
> On the one side I see your argument that you don't want to have your structs
> poluted with things that don't belong to svn

I very much don't want to have our structs polluted with fields for the
benefit of very specific callers.

, on the other side it's a
> common approach to have some user data member

It's common when you're going to make a callback.  It's not common to
just randomly insert them into structures.  And in the unusual cases
where you do (e.g. a GNOME widget), you generally have an API for
setting and accessing them; you don't just tack them on at the end.

(I'll note that given Greg Stein's approach, our ABI changes if we add
or remove editor functions, unless we're careful to do so only at the
end of the structure.  That's trivially addressed by putting ctx at the
beginning, but it illustrates the dangers of using non-opaque data types
in an API.)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [ghudson@MIT.EDU: Re: svn commit: rev 3110 -trunk/subversion/include]

Posted by Gerald Richter <ri...@ecos.de>.
> On Mon, 2002-09-02 at 02:45, Gerald Richter wrote:
> > I hope this make things more clear, if not just ask again. If I am
overseen
> > something here and there is a better way to do these things I am happy
to
> > learn...
>
> Perhaps a hash table mapping the dav_resource pointer to the perl
> object?  You'd need some way of cleaning that up when a dav_resource
> structure is freed (or rather, when its containing pool is freed), but I
> think you'd need that anyway to get the reference counts right.
>

Of course you can use a hash table (something similar I am doing for mod_dav
1.x currently), but it's not a very great and performant solution:

- You have a hash lookup on every function entry per structure
-  You loose the connection when a structre is moved around in memory (this
doesn't happen too often, so this may not be a big problem)
- When the C struct is deleted without notice, your hash entry points to
already freed memory and you don't have a chance to reliable deteced it, so
you have a good chance getting a SIGSEGV...
- When threads come into play (APache 2.0 worker MPM) you have to deal with
locking and serialization access to this hash (in Perl you have to
addtionaly make this hash shared), which will reduce performance again.

On the one side I see your argument that you don't want to have your structs
poluted with things that don't belong to svn, on the other side it's a
common approach to have some user data member (or function argument which is
passed to callback) and it makes life so much easier when you try to do a
mapping to some other language. I think it will be even make lifer easier
for people who want to interface thier code with mod_dav or svn in C.

Gerald




-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org