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

svn_fs__parse_skel prototype question

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2002-12-03 19:23:34 CET

Hello

While doing an "enable lots of warnings" build I came across
svn_fs__parse_skel in libsvn_fs/util/skel.h, which looks like

  /* Parse the LEN bytes at DATA as the concrete representation of a
     skel, and return a skel object allocated from POOL describing its
     contents. If the data is not a properly-formed SKEL object, return
     zero.

     The returned skel objects point into the block indicated by DATA
     and LEN; we don't copy the contents.

     You'd think that DATA would be a `const char *', but we want to
     create `skel' structures that point into it, and a skel's DATA
     pointer shouldn't be a `const char *', since that would constrain
     how the caller can use the structure. We only want to say that
     *we* won't change it --- we don't want to prevent the caller from
     changing it --- but C's type system doesn't allow us to say that. */
  skel_t *svn_fs__parse_skel (char *data, apr_size_t len,
                              apr_pool_t *pool);

I don't understand the comment about not using 'const char*' for DATA.
If svn_fs__parse_skel is not going to change DATA then 'const char*'
is exactly what is wanted, and making it const in no way constrains
the callers.

The comment has been there since rev 1. Can anyone explain what the
author meant? If not, I'll change it.

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Dec 3 19:24:22 2002

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.