[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 final (I hope) version

From: Max Bowsher <maxb_at_ukf.net>
Date: 2005-05-23 20:59:31 CEST

Here we go again with the keywords-as-hash thing...

Peter N. Lundblad wrote:
> On Sun, 24 Apr 2005, Max Bowsher wrote:
>
>> Here is what I hope to be the final version of the actual API change
>> portion of the keywords-as-hash patch.
>>
>> I would appreciate any reviews, especially regarding whether there are
>> any missing "const"s in the new APIs.
>>
> Didn't find anything major, except for const apr_hash_t* in the APIs (see
> below).

OK, fixed all the issues except one...

>> + {
>> + const char *key;
>> + svn_string_t *a_val, *b_val;
>> +
>> + apr_hash_this (hi, (void *) &key, NULL, (void *) &a_val);
>
> This is incorrect. You should cast to (void**), and that's not
> conformant. Casting pointer-to-pointer-to-sometype to void** doesn't
> work. You need two temporary void* variables as in many other places.

(void**) works for me - is it a GCC extension?
If we really can't use (void**), then I would like to use (void*) - it is,
after all accurate, as a void* is a pointer to anything - even another
void*.

I've also made additional changes - eliminated the changes to svn_types.h
entirely, and swallowed the implementation of date_prop_to_human into
keyword_prinf.

Max.

[[[
Revise keywords API - represent keywords as a hash for better extensibility.
Implement internal printf-like format characters for keyword expansion.
A part of issue #890. Note that this only introduces the new APIs - making
the rest of the code make use of them will be a separate commit.
Based on a patch by John Peacock <jpeacock@rowman.com>, which was in turn
based on a patch by "plasma" <plasmaball@pchome.com.tw>.
Significant review from Peter Lundblad.

* subversion/includes/svn_subst.h:
  (svn_subst_keywords_t): Deprecated.
  (svn_subst_build_keywords2): Interface change; hash instead of struct.
  (svn_subst_build_keywords): Deprecated.
  (svn_subst_keywords_differ2): Interface change.
    A new argument apr_pool_t *pool and use hash instead of struct.
  (svn_subst_keywords_differ): Deprecated.
  (svn_subst_translate_stream3): Interface change; hash instead of struct.
  (svn_subst_translate_stream2): Deprecated.
  (svn_subst_copy_and_translate3): Interface change; hash instead of struct.
  (svn_subst_copy_and_translate2): Deprecated.
  (svn_subst_translate_cstring2): Interface change; hash instead of struct.
  (svn_subst_translate_cstring): Deprecated.

* subversion/libsvn_subr/svn_subst.c:
  (keyword_printf): New private function;
    printf-style formatting of keywords based on format strings.
  (date_prop_to_human): Swallowed by keyword_printf.
  (kwstruct_to_kwhash): New private function;
    convert keywords struct into keywords hash.
  (svn_subst_build_keywords): Convert to API compatibility wrapper.
  (svn_subst_build_keywords2): Build keywords using keyword_printf().
  (translate_keyword): Interface changes. Also, look up the keyword in the
    passed in buffer, instead of trying to translate all possibilities.
  (svn_subst_keywords_differ): Retain unchanged for API compatibility.
  (svn_subst_keywords_differ2): New function;
    compare two hashes instead of comparing individual structure elements.
  (svn_subst_translate_stream2): Convert to API compatibility wrapper.
  (svn_subst_translate_stream3): Change interface only.
  (svn_subst_translate_cstring): Convert to API compatibility wrapper.
  (svn_subst_translate_cstring2): Update function call to new API version.
  (svn_subst_copy_and_translate2): Convert to API combatibility wrapper.
  (svn_subst_copy_and_translate3): Update function call to new API version.
  (svn_subst_translate_string): Update function call to new API version.
  (svn_subst_detranslate_string): Update function call to new API version.
]]]

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

  • application/octet-stream attachment: 1d.patch
Received on Mon May 23 21:00:57 2005

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.