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

2014-09-01 Thread Ruediger Pluem


jaillet...@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=1621806r1=1621805r2=1621806view=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=1621806r1=1621805r2=1621806view=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

2014-09-01 Thread Marion Christophe JAILLET

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 :

jaillet...@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=1621806r1=1621805r2=1621806view=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=1621806r1=1621805r2=1621806view=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