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

Re: [PATCH] Remove warning about code not beeing executed

From: Stefan Sperling <stsp_at_elego.de>
Date: Thu, 5 Nov 2009 19:34:59 +0100

On Thu, Nov 05, 2009 at 07:28:18PM +0100, Daniel Näslund wrote:
> [[[
> Fix warning of code never beeing executed.
>
> * subversion/libsvn_client/deprecated.c
> (wrap_pre_blame3_receiver): Add eol parameter to avoid check of
> strlen() against APR_EOL_STR.
> (svn_client_blame2, svn_client_blame): Update caller to pass
> APR_EOL_STR as eol.
>
> Patch by: Daniel Näslund <daniel_at_longitudo.com>
> ]]]
>
> /Daniel

> Index: subversion/libsvn_client/deprecated.c
> ===================================================================
> --- subversion/libsvn_client/deprecated.c (revision 40386)
> +++ subversion/libsvn_client/deprecated.c (arbetskopia)
> @@ -284,10 +284,10 @@
>
> static void
> wrap_pre_blame3_receiver(svn_client_blame_receiver_t *receiver,
> - void **receiver_baton,
> + void **receiver_baton, const char *eol,
> apr_pool_t *pool)
> {
> - if (strlen(APR_EOL_STR) > 1)
> + if (strlen(eol) > 1)

No idea if we really need to fix this.
There's a nice snippet in libsvn_subr/prompt.c which generates a similar
warning but avoids strlen():

              /* GCC might complain here: "warning: will never be executed"
               * That's fine. This is a compile-time check for "\r\n\0" */
              if (sizeof(APR_EOL_STR) == 3)
                {
                  saw_first_half_of_eol = TRUE;
                  continue;
                }

Stefan

> {
> struct wrapped_receiver_baton_s *b = apr_palloc(pool,sizeof(*b));
>
> @@ -309,7 +309,7 @@
> svn_client_ctx_t *ctx,
> apr_pool_t *pool)
> {
> - wrap_pre_blame3_receiver(&receiver, &receiver_baton, pool);
> + wrap_pre_blame3_receiver(&receiver, &receiver_baton, APR_EOL_STR, pool);
> return svn_client_blame3(target, peg_revision, start, end,
> svn_diff_file_options_create(pool), FALSE,
> receiver, receiver_baton, ctx, pool);
> @@ -323,7 +323,7 @@
> svn_client_ctx_t *ctx,
> apr_pool_t *pool)
> {
> - wrap_pre_blame3_receiver(&receiver, &receiver_baton, pool);
> + wrap_pre_blame3_receiver(&receiver, &receiver_baton, APR_EOL_STR, pool);
> return svn_client_blame2(target, end, start, end,
> receiver, receiver_baton, ctx, pool);
> }

-- 
printf("Eh???/n");
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2414871
Received on 2009-11-05 19:35:18 CET

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.