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

Re: PATCH: Remove unnecessary type casts

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2004-03-08 00:49:02 CET

Julian Foad <julianfoad@btopenworld.com> writes:

> OK for me to commit this?
>
> The API change in it is only to a private API, which, as I
> understand it, can be changed in any release. (If it were a public
> API, it would be relevant that this is a loosening of the API, which
> is source-compatible in one direction, though I'm not sure about
> binary compatibility.)

> Index: subversion/libsvn_fs/bdb/dbt.c
> ===================================================================
> --- subversion/libsvn_fs/bdb/dbt.c (revision 8769)
> +++ subversion/libsvn_fs/bdb/dbt.c (working copy)

> @@ -147,7 +147,7 @@
> /* Set DBT to the text of the null-terminated string STR. DBT will
> refer to STR's storage. Return DBT. */
> DBT *
> -svn_fs__str_to_dbt (DBT *dbt, char *str)
> +svn_fs__str_to_dbt (DBT *dbt, const char *str)
> {
> svn_fs__set_dbt (dbt, str, strlen (str));
> return dbt;

I believe this is ABI compatible on a gcc/Linux platform. I'm not
certain this is guaranteed by the C standard, but I think function
type compatibility relies on the unqualified type of the function
parameters (6.7.5.3/15), whch would make it OK.

Is it a good idea? The str parameter ends up getting cast to
non-const inside svn_fs__set_dbt, do all the places that retrieve it
treat it as const?

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Mar 8 00:49:17 2004

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.