You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ja...@apache.org on 2014/09/01 16:40:01 UTC

svn commit: r1621806 - in /httpd/httpd/trunk: modules/loggers/mod_journald.c modules/mappers/mod_negotiation.c modules/proxy/mod_proxy_wstunnel.c server/util_expr_eval.c

Author: jailletc36
Date: Mon Sep  1 14:40:01 2014
New Revision: 1621806

URL: http://svn.apache.org/r1621806
Log:
Silent some cppcheck warnings.

Modified:
    httpd/httpd/trunk/modules/loggers/mod_journald.c
    httpd/httpd/trunk/modules/mappers/mod_negotiation.c
    httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c
    httpd/httpd/trunk/server/util_expr_eval.c

Modified: httpd/httpd/trunk/modules/loggers/mod_journald.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/loggers/mod_journald.c?rev=1621806&r1=1621805&r2=1621806&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/loggers/mod_journald.c (original)
+++ httpd/httpd/trunk/modules/loggers/mod_journald.c Mon Sep  1 14:40:01 2014
@@ -114,9 +114,9 @@ static void journald_log(apr_pool_t *poo
     /* Adds new entry to iovec if previous additions were successful. */
 #define IOVEC_ADD_LEN(FORMAT, VAR, LEN) \
     if (rv == APR_SUCCESS && iov_size < MAX_ENTRIES) { \
-        if ((rv = iovec_add_entry(subpool, &iov[iov_size], FORMAT, LEN, VAR)) \
-            == APR_SUCCESS) \
-                iov_size++; \
+        rv = iovec_add_entry(subpool, &iov[iov_size], FORMAT, LEN, VAR); \
+        if (rv == APR_SUCCESS) \
+            iov_size++; \
     }
 #define IOVEC_ADD(FORMAT, VAR) IOVEC_ADD_LEN(FORMAT, VAR, -1)
 

Modified: httpd/httpd/trunk/modules/mappers/mod_negotiation.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_negotiation.c?rev=1621806&r1=1621805&r2=1621806&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mappers/mod_negotiation.c (original)
+++ httpd/httpd/trunk/modules/mappers/mod_negotiation.c Mon Sep  1 14:40:01 2014
@@ -1707,7 +1707,7 @@ static void set_language_quality(negotia
              * we are allowed to use the prefix of in HTTP/1.1
              */
             char *lang = ((char **) (variant->content_languages->elts))[j];
-            int idx = -1;
+            int idx;
 
             /* If we wish to fallback or
              * we use our own LanguagePriority index.

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c?rev=1621806&r1=1621805&r2=1621806&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c Mon Sep  1 14:40:01 2014
@@ -318,7 +318,7 @@ static int proxy_wstunnel_request(apr_po
                                 apr_uri_t *uri,
                                 char *url, char *server_portstr, char *scheme)
 {
-    apr_status_t rv = APR_SUCCESS;
+    apr_status_t rv;
     apr_pollset_t *pollset;
     apr_pollfd_t pollfd;
     conn_rec *c = r->connection;

Modified: httpd/httpd/trunk/server/util_expr_eval.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_expr_eval.c?rev=1621806&r1=1621805&r2=1621806&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_expr_eval.c (original)
+++ httpd/httpd/trunk/server/util_expr_eval.c Mon Sep  1 14:40:01 2014
@@ -240,10 +240,8 @@ static int ap_expr_eval_comp(ap_expr_eva
                 do {
                     const ap_expr_t *val = e2->node_arg1;
                     AP_DEBUG_ASSERT(e2->node_op == op_ListElement);
-                    if (strcmp(needle, ap_expr_eval_word(ctx, val)) == 0) {
+                    if (strcmp(needle, ap_expr_eval_word(ctx, val)) == 0)
                         return 1;
-                        break;
-                    }
                     e2 = e2->node_arg2;
                 } while (e2 != NULL);
             }



Re: svn commit: r1621806 - in /httpd/httpd/trunk: modules/loggers/mod_journald.c modules/mappers/mod_negotiation.c modules/proxy/mod_proxy_wstunnel.c server/util_expr_eval.c

Posted by Marion & Christophe JAILLET <ch...@wanadoo.fr>.
It is not an issue, it was just to silent some cppcheck warnings.

In these 2 cases, it is obvious that explicitly initializing these 
variables is useless because it is assigned just a few lines after.

Moreover:
    - mod_negotiation.c: set just the line after.
    - mod_proxy_wstunnel.c: the other functions of this module do not 
initialize 'apr_status_t' variables when the use it.


My goal is, little by little, to fix cppcheck warnings when safe or obvious.
cppcheck is updated quite often and reducing the "noise" helps when new 
findings are reported.

CJ


Le 01/09/2014 20:20, Ruediger Pluem a écrit :
> jailletc36@apache.org wrote:
>> Author: jailletc36
>> Date: Mon Sep  1 14:40:01 2014
>> New Revision: 1621806
>>
>> URL: http://svn.apache.org/r1621806
>> Log:
>> Silent some cppcheck warnings.
>>
>> Modified:
>>      httpd/httpd/trunk/modules/loggers/mod_journald.c
>>      httpd/httpd/trunk/modules/mappers/mod_negotiation.c
>>      httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c
>>      httpd/httpd/trunk/server/util_expr_eval.c
>>
>> Modified: httpd/httpd/trunk/modules/mappers/mod_negotiation.c
>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_negotiation.c?rev=1621806&r1=1621805&r2=1621806&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/modules/mappers/mod_negotiation.c (original)
>> +++ httpd/httpd/trunk/modules/mappers/mod_negotiation.c Mon Sep  1 14:40:01 2014
>> @@ -1707,7 +1707,7 @@ static void set_language_quality(negotia
>>                * we are allowed to use the prefix of in HTTP/1.1
>>                */
>>               char *lang = ((char **) (variant->content_languages->elts))[j];
>> -            int idx = -1;
>> +            int idx;
> What exactly is the issue with an initialized variable?
>
>>   
>>               /* If we wish to fallback or
>>                * we use our own LanguagePriority index.
>>
>> Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c
>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c?rev=1621806&r1=1621805&r2=1621806&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c (original)
>> +++ httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c Mon Sep  1 14:40:01 2014
>> @@ -318,7 +318,7 @@ static int proxy_wstunnel_request(apr_po
>>                                   apr_uri_t *uri,
>>                                   char *url, char *server_portstr, char *scheme)
>>   {
>> -    apr_status_t rv = APR_SUCCESS;
>> +    apr_status_t rv;
> What exactly is the issue with an initialized variable?
>
>>       apr_pollset_t *pollset;
>>       apr_pollfd_t pollfd;
>>       conn_rec *c = r->connection;
>>
> Regards
>
> Rüdiger
>


Re: svn commit: r1621806 - in /httpd/httpd/trunk: modules/loggers/mod_journald.c modules/mappers/mod_negotiation.c modules/proxy/mod_proxy_wstunnel.c server/util_expr_eval.c

Posted by Ruediger Pluem <rp...@apache.org>.

jailletc36@apache.org wrote:
> Author: jailletc36
> Date: Mon Sep  1 14:40:01 2014
> New Revision: 1621806
> 
> URL: http://svn.apache.org/r1621806
> Log:
> Silent some cppcheck warnings.
> 
> Modified:
>     httpd/httpd/trunk/modules/loggers/mod_journald.c
>     httpd/httpd/trunk/modules/mappers/mod_negotiation.c
>     httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c
>     httpd/httpd/trunk/server/util_expr_eval.c
> 

> Modified: httpd/httpd/trunk/modules/mappers/mod_negotiation.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_negotiation.c?rev=1621806&r1=1621805&r2=1621806&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/mappers/mod_negotiation.c (original)
> +++ httpd/httpd/trunk/modules/mappers/mod_negotiation.c Mon Sep  1 14:40:01 2014
> @@ -1707,7 +1707,7 @@ static void set_language_quality(negotia
>               * we are allowed to use the prefix of in HTTP/1.1
>               */
>              char *lang = ((char **) (variant->content_languages->elts))[j];
> -            int idx = -1;
> +            int idx;

What exactly is the issue with an initialized variable?

>  
>              /* If we wish to fallback or
>               * we use our own LanguagePriority index.
> 
> Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c?rev=1621806&r1=1621805&r2=1621806&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c (original)
> +++ httpd/httpd/trunk/modules/proxy/mod_proxy_wstunnel.c Mon Sep  1 14:40:01 2014
> @@ -318,7 +318,7 @@ static int proxy_wstunnel_request(apr_po
>                                  apr_uri_t *uri,
>                                  char *url, char *server_portstr, char *scheme)
>  {
> -    apr_status_t rv = APR_SUCCESS;
> +    apr_status_t rv;

What exactly is the issue with an initialized variable?

>      apr_pollset_t *pollset;
>      apr_pollfd_t pollfd;
>      conn_rec *c = r->connection;
> 

Regards

Rüdiger