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

Re: svn commit: r1626247 - /subversion/trunk/subversion/libsvn_ra_svn/client.c

From: Branko Čibej <brane_at_wandisco.com>
Date: Sat, 20 Sep 2014 10:11:49 +0200

On 19.09.2014 17:21, ivan_at_apache.org wrote:
> Author: ivan
> Date: Fri Sep 19 15:21:15 2014
> New Revision: 1626247
> URL: http://svn.apache.org/r1626247
> Log:
> Resolve another compiler warning.
> * subversion/libsvn_ra_svn/client.c
> (find_tunnel_agent): Add non-const local variable ARGV to fix compiler
> warning.

Which compiler is that, and what warning does it emit? There is nothing
wrong with the code, and I've not seen any warnings from that code in
ages, with either gcc or clang. Specifically:

> -/* (Note: *ARGV is an output parameter.) */
> +/* (Note: *ARGV_P is an output parameter.) */
> static svn_error_t *find_tunnel_agent(const char *tunnel,
> const char *hostinfo,
> - const char ***argv,
> + const char ***argv_p,
> apr_hash_t *config, apr_pool_t *pool)

The original 'argv' parameter is *not* constant. It is a non-const
pointer to a non-const array of (const char*). There should be no
warnings when assigning to the pointer, and no warnings when modifying
the array. The only thing you can't do is modify the data the array
elements are pointing to, but the code did not do that.

Incidentally, I agree with using a for-loop to copy the initial argument
array instead of a memcpy; it makes the intent of the code clearer.

OTOH, I really do not like code changes that cater to broken compilers.

-- Brane
Received on 2014-09-20 10:12:18 CEST

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