Login | Register
My pages Projects Community openCollabNet

Discussions > dev [DISABLED] > Re: [PATCH] Remove warning about code not beeing executed

subversion
Discussion topic

Back to topic list

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

Author stsp
Full name Stefan Sperling
Date 2009-11-05 10:35:04 PST
Message On Thu, Nov 05, 2009 at 07:28:18PM +0100, Daniel Näslund wrote:
> [[[
> Fix warning of code never beeing executed.
>
> * subversion/libsvn_cl​ient/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 dot com>
> ]]]
>
> /Daniel

> Index: subversion/libsvn_cl​ient/deprecated.c
> ====================​====================​====================​=======
> --- subversion/libsvn_cl​ient/deprecated.c (revision 40386)
> +++ subversion/libsvn_cl​ient/deprecated.c (arbetskopia)
> @@ -284,10 +284,10 @@
>
> static void
> wrap_pre_blame3_rece​iver(svn_client_blam​e_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_rece​iver(&receiver, &receiver_baton, pool);
> + wrap_pre_blame3_rece​iver(&receiver, &receiver_baton, APR_EOL_STR, pool);
> return svn_client_blame3(target, peg_revision, start, end,
> svn_diff_file_option​s_create(pool), FALSE,
> receiver, receiver_baton, ctx, pool);
> @@ -323,7 +323,7 @@
> svn_client_ctx_t *ctx,
> apr_pool_t *pool)
> {
> - wrap_pre_blame3_rece​iver(&receiver, &receiver_baton, pool);
> + wrap_pre_blame3_rece​iver(&receiver, &receiver_baton, APR_EOL_STR, pool);
> return svn_client_blame2(target, end, start, end,
> receiver, receiver_baton, ctx, pool);
> }


--
printf("Eh???/n");

« Previous message in topic | 2 of 7 | Next message in topic »

Messages

Show all messages in topic

[PATCH] Remove warning about code not beeing executed dannas Daniel Näslund 2009-11-05 10:28:26 PST
     Re: [PATCH] Remove warning about code not beeing executed stsp Stefan Sperling 2009-11-05 10:35:04 PST
         Re: [PATCH] Remove warning about code not beeing executed julianfoad Julian Foad 2009-11-05 10:50:26 PST
             Re: [PATCH] Remove warning about code not beeing executed Daniel Shahaf <d dot s at daniel dot shahaf dot name> Daniel Shahaf <d dot s at daniel dot shahaf dot name> 2009-11-05 10:58:23 PST
                 Re: [PATCH] Remove warning about code not beeing executed julianfoad Julian Foad 2009-11-05 11:23:59 PST
         Re: [PATCH] Remove warning about code not beeing executed brane Branko Cibej 2009-11-05 13:25:23 PST
             Re: [PATCH] Remove warning about code not beeing executed dlr Daniel Rall 2009-11-05 16:33:27 PST
Messages per page: