[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Keywords as hash: API design: null or empty hash

From: John Peacock <jpeacock_at_rowman.com>
Date: 2005-09-22 15:32:43 CEST

Max Bowsher wrote:
> Was there any different significance between an allocated
> svn_subst_keywords_t filled with NULL values, and a NULL
> svn_subst_keywords_t * pointer?

Well, empty strings not NULL values, but you get the idea. I need to
work through in my head the three cases:

1) *keywords == NULL
2) *keywords == empty hash or struct with empty strings
3) *keywords == filled hash or struct with filled strings

I believe the primary reason that *keywords was ever set to NULL was to
call some of the functions when you explicitly didn't want to deal with
the keywords.

I couldn't recall (not having looked at that part of the code in a
while) the exact circumstances where you could ever have an empty hash.
  Look at the code, it appears that the only time you would get an empty
hash is if svn:keywords was set but contained no legal keyword values.
I think this is even more evidence that svn_subst_build_keywords2()
should never actively return an empty hash and all code should be
adjusted to correspond.

To make Julian more comfortable, perhaps we could create a typedef to
alias apr_hash_t, and define that type as having two possible values:

a) NULL
b) a hash containing at least one key/value pair

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4501 Forbes Boulevard
Suite H
Lanham, MD  20706
301-459-3366 x.5010
fax 301-429-5748
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Sep 22 15:33:27 2005

This is an archived mail posted to the Subversion Dev mailing list.